OK, then I guess I really should move extensions/groovy into a sandbox
somewhere and wait for this to see if it can replace the JSON Builder in
extensions/groovy.

Although the existing one from json-lib did not play well with OSGi for some
reason.

Justin

On Sat, Jan 29, 2011 at 12:51 PM, Felix Meschberger <[email protected]>wrote:

> For all those us interested in groovy and JSON ... JSON will be becoming
> even easier to use in Groovy ... Let's se what we can do about this or
> for this in Sling ;-) [Besides upgrading to 1.8 once it is published]
>
> Regards
> Felix
>
>
>
> ---------- Forwarded message ----------
> From: Guillaume Laforge <[email protected]>
> To: dev <[email protected]>
> Date: Fri, 28 Jan 2011 17:26:05 +0100
> Subject: [groovy-dev] Built-in JSON support in 1.8
> 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:
> http://bamboo.ci.codehaus.org/browse/GROOVY-CORE-5493/artifact/deliverables
>
> You can have a look at the *JSON GEP* that Andres and I started a few
> months ago (GEP-7):
> http://docs.codehaus.org/display/GroovyJSR/GEP+7+-+JSON+Support
> It shows some of the examples.
>
> But you can have a better overview of the various possibilities by looking
> at the test cases here:
>
> http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/test/groovy/json/
> In particular the builder tests:
>
> http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/test/groovy/json/JsonBuilderTest.groovy
> And the parser tests:
>
> http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/test/groovy/json/JsonSlurperTest.groovy
>
> http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/test/groovy/json/RealJsonPayloadsTest.groovy
>
> And you can have a look at the sources too:
>
> http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/groovy/json/
> <http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/groovy/json/>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:
>
> http://docs.codehaus.org/display/GroovyJSR/GEP+7+-+JSON+Support#GEP7-JSONSupport-Openquestions
> 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.
>
> --
> Guillaume Laforge
> Groovy Project Manager
> Head of Groovy Development at SpringSource
> http://www.springsource.com/g2one
>
>
>

Reply via email to