Groovy web console

subscribe to the feed Subscribe
to this
site

Evaluate Groovy JSON

Published 2 weeks ago by Gaurav Khare with tags json updateJson
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.json.*
def jsonSlurper = new JsonSlurper()
def object = jsonSlurper.parseText('{ "name": "John Doe" } /* some comment */') 
object.name = 'abc'
println(object.name)

def jsonStr = JsonOutput.toJson(object)