def p = new Expando(
name:'Mary',
pets:[
new Expando(name:'Fido', species:'Dog'),
new Expando(name:'Snickers', species:'Cat')
]
)
def json = new JsonBuilder()
json( {
name p.name,
pets( p.pets.collect {[
name:it.name,
species:it.species
]})
})
JsonOutput.prettyPrint(json.toString())
About digital things I find interesting. Like internet, software development, mobile phones, social media
About Me
- Olaf
- Freelancing software developer / architect, mobile geek. Topics: Software technologies (java, groovy, agile), politics, web, science, green, mobile, android.
Homepage: www.tutaona.com
"The absence of limitations is the enemy of art." - Orson Welles
Montag, 25. Juni 2012
Easy JSON Building
Abonnieren
Kommentare zum Post (Atom)
Keine Kommentare:
Kommentar veröffentlichen