tsjakamaka
5 years agoOccasional Contributor
Getting data out of json response
Hi, As result of a GET call of REST service, I have following JSON response. { "result": [ { "role": "ADMIN", "relationNumber": 8046017, "individual": { "firstName": "aaaa", "lastName"...
- 5 years ago
Have a script with following snippet:
//assign the response for jsonString Variable def jsonString = def individualViewer = new groovy.json.JsonSlurper().parseText(jsonString).result.find{it.role == 'VIEWER'}.individual log.info "first name: ${individualViewer.firstName}" log.info "last name: ${individualViewer.lastName}"
You can test it online