Skip to content

Instantly share code, notes, and snippets.

@dalmat36
Last active August 29, 2015 14:25
Show Gist options
  • Save dalmat36/387b8bc462932921876e to your computer and use it in GitHub Desktop.
Save dalmat36/387b8bc462932921876e to your computer and use it in GitHub Desktop.
import groovy.json.JsonBuilder
class GroovyJsonBuilderPerson {
static main(args) {
def json = new JsonBuilder()
json.'person'{
'firstName' ('matt')
'lastName'('Dalesio')
'age'(30)
}
println(json.toPrettyString())
}
}
{
"person": {
"firstName": "matt",
"lastName": "Dalesio",
"age": 30
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment