TestProject Forum
Powered by leading experts in the test automation community

Is there a way to loop in JsonArray in the response and validate the value of a json object for all items in the JsonArray

I have a scenario where I need to check the health of few modules of my application in the response. All the modules are returned in the response as JsonArray.

I created a test to fetch the response and stored the response in an output parameter. In another test , I used the Get value from JSON using JsonPath from JSON Operations to validate data in a loop. However this is not working as the data stored in output parameter is String and not JsonObject

The only way I can think of is having a test with 2 steps. 1 step for fetching response and another step to validate the value of json object using String compare or contains operation. To validate all values in the array I need to have the Jsonexpressions for all JsonArray items in csv file and execute the script in data driven approach. But the problem with this solution is, everytime Get request has to be triggered and also if more items are added to JsonArray, I need to update the csv file

Is there a way to solve this issue

Hello @nirupamav.

Can you please contact us on the support chat so that we can assist you?
You can access the support chat from this icon on the site:

1 Like