atom feed16 messages in[groovy-dev] Built-in JSON support in...
FromSent OnAttachments
Guillaume LaforgeJan 28, 2011 8:25 am 
Alex TkachmanJan 28, 2011 8:40 am 
Guillaume LaforgeJan 28, 2011 8:43 am 
Cédric CHAMPEAUJan 28, 2011 8:49 am 
Guillaume LaforgeJan 28, 2011 8:58 am 
Merlyn AlberyJan 28, 2011 9:23 am 
Thom NicholsJan 28, 2011 11:20 am 
Jochen TheodorouJan 28, 2011 11:52 am 
Thom NicholsJan 28, 2011 12:48 pm 
Guillaume LaforgeJan 28, 2011 2:56 pm 
Guillaume LaforgeJan 28, 2011 3:06 pm 
Jochen TheodorouJan 29, 2011 12:00 am 
Thom NicholsJan 29, 2011 10:42 am 
Guillaume LaforgeJan 29, 2011 12:30 pm 
Paulo Gabriel PoiatiJan 29, 2011 2:03 pm 
Guillaume LaforgeJan 29, 2011 2:12 pm 
Subject:[groovy-dev] Built-in JSON support in 1.8
From:Guillaume Laforge (
Date:Jan 28, 2011 8:25:55 am

Hi all,

As part of the Groovy 1.8 roadmap, we had an item for *supporting JSON* in Groovy, similarily as to how we support XML, namely by providing a parser (slurper) and a builder. I've implemented a Groovy *JsonSlurper* and *JsonParser*, in the * groovy.json* package. It's currently in Trunk.

You can play with those parser and builder by using a snapshot of Groovy 1.8 that you can find on Bamboo, for example:

You can have a look at the *JSON GEP* that Andres and I started a few months ago (GEP-7): It shows some of the examples.

But you can have a better overview of the various possibilities by looking at the test cases here: In particular the builder tests: And the parser tests:

And you can have a look at the sources too: <>Be sure to look at the JavaDocs which show various examples as well.

Although JSON and XML are pretty different, it would be nice if xml builders and json builder would be even closer (which is one of the goals of the built-in JSON support), as for example the following cases are not covered by the current implementation: I'd be interested in your input as how you'd expect such calls on the builder should serialize the JSON output, or even if we should even support them at all.

Thanks for your attention.