This question: How to parse JSON in Java Has several answers which require including 3rd party libraries, including GSON, org.json and Jackson.
I am using Adobe AEM, which is notoriously intolerant of including 3rd party libraries, so am trying to do the REST API calling with standard Java 11. java 11 has the HTTPClient classes, which will give me JSON from the response.
Now I need to convert Json into the required java object.
E.g. I have a Person class with name and age fields, and want to get a Person object from something like {"name":"bob", "age":12}
I will also need something to convert a Java object into Json.
Any suggestions?
There is something called JsonObject in java 7, but I have not been able to find any examples which show this conversion.