Groovy web console

subscribe to the feed Subscribe
to this
site
Basic StringToJson (via #groovywebconsole)
tweet this snippet Tweet
this
script

Basic StringToJson

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

def str = $/[]/$
def json = new JsonSlurper().parseText(str)


JsonOutput.prettyPrint(JsonOutput.toJson(json))