Forum Discussion
richie
2 years agoCommunity Hero
Hey raygoel,
There's a number of ways to do this, but the answer kinda depends on whether your response is static inasmuch that the json you've published has 5 objects in the array. Are you always gonna get 5 objects (or less) or will the number of objects change?
Reason i'm asking is that if the response is dynamic youll need groovy script, if it's static, we can do it with the embedded functionality no problem.
Cheers,
Rich
There's a number of ways to do this, but the answer kinda depends on whether your response is static inasmuch that the json you've published has 5 objects in the array. Are you always gonna get 5 objects (or less) or will the number of objects change?
Reason i'm asking is that if the response is dynamic youll need groovy script, if it's static, we can do it with the embedded functionality no problem.
Cheers,
Rich
- raygoel2 years agoOccasional Contributor
Thanks for your response richie
The response depends on how the application is setup. In this case, I have set it up so that this response is always going to be static. I tried using the wild card notation for JSON path $[*]['Id'] but it did not work in this case. However, if I try it online with a JSON path explorer it correctly returns the IDs.
-Ray
- raygoel2 years agoOccasional Contributor
Any more ideas about solving this problem? For now, I have built a grid of data to assert against since the response and data will be static.
Related Content
- 5 years agoRahul12