Groovy web console

subscribe to the feed Subscribe
to this
Objects from JSON (via #groovywebconsole)
tweet this snippet Tweet

Objects from JSON

Published 8 months ago by Manuel Quindimil with tags json object
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def jsonSlurper = new groovy.json.JsonSlurper()
def object = jsonSlurper.parseText '''     { "simple": 123,       "fraction": 123.66,       "exponential": 123e12     }'''

class Obj {
String simple
String fraction
String exponential

println new Obj(object).dump()