A JSON Response Example
Suppose we have the following JSON response, and we want to parse and retrieve its data: { “menu”: { “id”: “file”, “tools”: { “actions”: [ { “id”: “new”, “title”: “New file” }, { “id”: “open”, “title”: “Open File” }, { “id”: “close”, “title”: “Close File” } ], “errors”: [] } } }
JsonSlurper
We use this Groovy helper class to parse JSON strings. We need to create a new instance of JsonSlurper and call the JsonSlurper.parseText method. Sample code: https://goo.gl/iVxBH7
Share this:
- Click to share on Facebook (Opens in new window)
- Click to share on Twitter (Opens in new window)
- Click to email a link to a friend (Opens in new window)
- Click to share on LinkedIn (Opens in new window)
- Click to share on Tumblr (Opens in new window)
- Click to share on Pinterest (Opens in new window)
- Click to share on Reddit (Opens in new window)