Groovy web console

subscribe to the feed Subscribe
to this

Read network JSON

Published 5 months ago by Amol Chavan
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.json.JsonSlurper

String JSON_URL = ""
URL url = new URL(JSON_URL)
InputStream urlStream = null
urlStream = url.openStream()
BufferedReader reader = new BufferedReader(new InputStreamReader(urlStream))
JsonSlurper jsonSlurper = new JsonSlurper()
Object result = jsonSlurper.parse(reader)
println (result.toString())