I am relatively new to Rest-assured and Gpath. From the JSON below, I just want to get a map with the keys / values for 'RideA'
[{
"state": "open",
"name": "RideA",
"imageCount": 2
},
{
"state": "open",
"name": "RideB",
"imageCount": 1
},
{
"state": "open",
"name": "RideC",
"imageCount": 2
}]
so far I have tried:
final List<Map<String, ?>> object = from(json).get("it.findAll { it.name == 'RideA' }");
but this returns java.lang.IllegalArgumentException: Cannot get property 'name' on null object , so I think there is something wrong with my syntax
The code below works, but I have to look up the elements with the list by their ordinal number (in this case '0'), when I want to look them up by the 'name' field
final List<Map<String,?>> object = from(json).get("");
assertThat(object.get(0).get("name"), IsEqual.<Object>equalTo("RideA"));
any help is much appreciated!