Groovy web console

subscribe to the feed Subscribe
to this
site
parse json to get token (via #groovywebconsole)
tweet this snippet Tweet
this
script

parse json to get token

Published 3 months ago by nmrao with tags parse json
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def response = """{
  "accessToken": "fjskjlkdkkfjsfk98294239482",
  "status": {
    "code": 0,
    "message": null
  }
}"""
def parsedJson = new groovy.json.JsonSlurper().parseText(response)
println parsedJson.accessToken