[json-lib-user] JsonGroovyBuilder examples
Brought to you by:
aalmiray
From: Kevin S. <kev...@gm...> - 2008-06-05 21:00:08
|
Using: * json-lib-2.2.1-jdk15.jar * groovy-all-minimal-1.5.6.jar The current JsonGroovyBuilder javadoc [1] gives 6 examples for constructing a Books object. Quoting from the javadoc: *all 6 books variables output the same JSON {"books": { "book": [{ "title": "The Definitive Guide to Grails", "author": "Graeme Rocher" },{ "title": "The Definitive Guide to Grails", "author": "Graeme Rocher" }] } }* However, when I try all 6 examples from the javadoc, the json produced is different. Namely, rather than being objects {}, the output is arrays []. *["books": [ "book": [[ "title":"The Definitive Guide to Grails", "author":"Graeme Rocher" ],[ "title":"The Definitive Guide to Grails", "author":"Graeme Rocher" ]] ] ]* Is this expected behavior? Thanks, Kevin [1] http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonGroovyBuilder.html |