ssteinhorst
8 years agoOccasional Contributor
validate json items in an array
I have an API that returns JSON and I'm unsure the best way to get to the element I'm trying to check. Here is a sample:
{
"Records": [{
"correlation_id": null,
"date": "2017-12-26",
"pay_period_end_date": "2017-12-31",
"work_unit": {
"id": "a1B1H00121212WUdfsdfX"
}
}, {
"correlation_id": null,
"date": "2017-12-26",
"pay_period_end_date": "2017-12-31",
"work_unit": {
"id": "kdkd9df980sdkdn2"
}
}]
}I'm trying to check that a specific Records[<somevalue>].work_unit.id value is present. We aren't always guaranteed to have them in the same order so I need to check if any object in the array has a work_unit.id of kdkd9df980sdkdn2.
I can get a jsonpath that will give me an array of the values but can't seem to see a way to validate that since the results changing order still causes the validation to fail.
Is there a feature of soapui that I'm missing that could do this? Any suggestions on how to tackle this problem? Thanks!