When I have arrays in response, getting proper results using Jayway, but not with io.restassured ? Can I use Jayway and io.restassured together ? Is that an acceptable / good practice?
JSON Response :
{"applications": [
{
"Id": "123",
"amount": "1500"
},
{
"Id": "456",
"amount": "2500"
},
{
"Id": "780",
"amount": "3500"
}
]}
Looking for amount 2500 as my result!
Tried below:
//1st approach to read response form json body
JsonPath jsonPath = res.jsonPath(); System.out.println(jsonPath.get("$.applications[1].amount"));
//results null, using io.restassured JsonPath
//2nd approach to read response form json body
JsonPath jsonPath1 = JsonPath.from(res.asString()); System.out.println(jsonPath1.getString("$.applications[1].amount"));
//results null, using io.restassured JsonPath
//3rd approach to read response form json body
System.err.println(JsonPath.read(res.asString(),"$.login"));
// results 2500, using jaywayJsonPath