I have the below response body (json) I want to do the below checks
1) Check if 'id=5' exist
*var expectedID = "5"
tests["Body cointains ID: " + expectedID] = responseBody.has(expectedID);*
2) If first check pass then check if for 'id=5' the name is equal to 'John Smith'
Any help apreciated
Response Body:
[
{
"id": 1,
"name": "George Smith",
"username": "John",
"email": "John@may.biz",
"address": {
"street": "Kennedy",
"suite": "Apt. 332",
"city": "Paris",
"zipcode": "12322-3874",
"geo": {
"lat": "-57.3189",
"lng": "81.1496"
}
},
"phone": "1-999-736-444 x343343",
"website": "web.org",
"company": {
"name": "Amaon",
"catchPhrase": "Multi-layered",
"bs": "e-markets"
}
},
{
"id": 5,
"name": "John Smith",
"username": "johny",
"email": "johny@john.com",
"address": {
"street": "Oxford",
"suite": "Suite 334",
"city": "London",
"zipcode": "12345",
"geo": {
"lat": "-32.3434",
"lng": "45.4543"
}
},
"phone": "(121)954-3457",
"website": "smith.info",
"company": {
"name": "Law LLC",
"catchPhrase": "Customer first",
"bs": "E2E system"
}
}
]