vendredi 15 décembre 2017

How to convert JSON response to Java List

I have a nested JSON response. JsonResponse Screenshot

I want to get the the dictionary at 0th location from the list and then get a particular element from it. For e.g. In response, {0} and {1}, I want to get complete {0} as a result. Then from {0}, I want to extract "Id" value only.
I don't want to use the JsonPath.read(JsonResponse String, JSON Path) everytime. So looking for some simple and better alternative.

How to convert JSON response to Java List. Below is the response.

Response resp = given().header("Authorization", "Bearer "+"dwded").
                accept(ContentType.JSON).
                when().
                get("https://example.com");      
                return resp;

Aucun commentaire:

Enregistrer un commentaire