Access elements of an anonymous array via JsonPath in RestAssured
Given that you have: [ {“foo”:1, “bar”:2 , “baz”:3 }, {“foo”:3, “bar”:4 , “baz”:5 } ] You can do the following in Rest Assured: then().body(“bar”,hasItems(2,4)) or expect().body(“bar”,hasItems(2,4)) if you’re using the legacy API.