I need help in validating the presence of one key in the response. The response of the API looks like -
"persons": [
{
"id": "27",
"source": {
"personId": 281,
"emailAddress": "abc@abc.com",
"firstName": "Steve"
}
},
{
"id": "28",
"source": {
"personId": 353,
"emailAddress": "abcd@abc.com",
"firstName": "John"
"LastName" : "Cena"
}
}
]
}
I want to assert if the source.LastName appears or not and if it does then it should always hold a string value.
The solution should be generic and it should work for 30 or 40 persons object also down the time, currently I am using karate version 0.9.4 and need a resolution for handling such scenarios.
Thanks in advance !