Forum Discussion
KarelHusa
3 years agoChampion Level 1
Hi krispokkuluri ,
you can try to analyze the JSON with JSONPath, e.g.:
import com.jayway.jsonpath.JsonPath
def json = new File("C:\\MyPath\\MyFile.json").text
def maxGrantDetailId = JsonPath.read(json, '$..GrantDetailId.max()')
def grantInfo = JsonPath.read(json, "\$..*[?(@.GrantDetailId == ${maxGrantDetailId})]")
assert grantInfo.Quantity[0] == 10
You can check your JSONPath at https://jsonpath.herokuapp.com/ and then apply it inGroovy.
Another option could be to utilize the JSON DataSource test step.
Best regards,
Karel
Related Content
- 10 years ago
- 3 years ago
Recent Discussions
- 14 hours ago