Groovy web console

subscribe to the feed Subscribe
to this
site

Untitled

Published 4 months ago by Anonymous
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.json.*
def json_req = '''{
"foo": {
    "bar": [{
        "python":"monty"
    }]
}
}'''
 
def json = new JsonSlurper().parseText(json_req)
println json.getClass().getName()
json.foo.bar[1] = "yee"
json.foo.bar.add("haw")
println JsonOutput.toJson(json)