You can easily access the JSON response content if you:
- use a java pojo generator that creates a complex java class structure out of a JSON string
- use GSon() to parse the JSON string into instances of the generated java classes.
**Generate classes:**
- Copy the whole JSON string into your clipboard and paste it into a java generator: http://www.jsonschema2pojo.org/
- Configure the generator:
- package = com.google.generated
- class = QueryResponse
- source type = JSON
- annotation style = GSON
- Generate generate the java source by pressing on the "JAR" button.
- Download download the generated sources.sources jar.
- copy the content of the sources-jar into your ivy projects sources folder
- parse the
**Parse JSON string after calling the REST service with Gson:as java objects**
- new Gson().fromJson("{complexResponse}", Gson().fromJson("{yourComplexResponse}", QueryResponse.class