My json array response is something like below:
response = [
{
"ID": "123",
"Name":"Test1",
"Data":{
"Status":"Red",
"Message":"user not valid",
"Code": "ERROR-P1"
}
},
{
"ID": "143",
"Name":"Test2",
"Data":{
"Status":"Amber",
"Message":"user data missing",
"Code": "ERROR-P2"
}
},
{
"ID": "133",
"Name":"Test3",
"Data":{
"Status":"Green",
"Message":"",
"Code": ""
}
}
There could be more entries in the json array with same data and status. My use case is to check, based on a condition that if my json array has Status as Red or Amber, then message and code is not empty and similarly if my status is Green then message and code is empty. I need to iterate to the entire array and validate this scenario. And also need to get a count of Status: Red, Amber and Greens from the Array Json response. What could be the best possible solution with karate? Any help would be appreciated. Thank you