I see that I can do the following with restassured. Given JSON:
{"locationId"=456,"name"="Home"}
I can get an object representing that json like this:
Location location = given().headers(headers).when().expect().statusCode(200).get(getUrl(urlQualifier)).as(Location.class);
How do I parse this JSON is I receive a root array of my Location objects in JSON. So, given this JSON:
[{"locationId"=1,name="Home"},{"locationId"=2,name="Work"}]
I want to parse out a List object. The following of course is a compile error, but it demonstrates what I am trying to do:
List<Location> list = given().headers(headers).when().expect().statusCode(200).get(getUrl(urlQualifier)).as((List<Location>).class);
{locationId=456,name="Home"}is not valid JSON. This is:{"locationId":456,"name":"Home"}.