Hi John,=0A=0AIt looks to me that your code should throw a different except=
ion because each book is no a Book per-se unless=0Aa) change brackets to cu=
rly braces=0Ab) add an explicit "cast" to Book with the as keyword=0A=0AThe=
following samples should work=0A=0Adef books1 =3D builder.books {=0A boo=
k =3D {title: "The Definitive Guide to Grails", author: "Graeme Rocher"}=0A=
book =3D {title: "The Definitive Guide to Grails", author: "Graeme Roche=
r"}=0A}=0A=0Adef books1 =3D builder.books {=0A book =3D [title: "The Defi=
nitive Guide to Grails", author: "Graeme Rocher"] as Book=0A book =3D [ti=
tle: "The Definitive Guide to Grails", author: "Graeme Rocher"] as Book=0A}=
=0A =0ACheers,=0AAndres=0A=0A=0A-------------------------------------------=
=0Ahttp://jroller.com/aalmiray=0Ahttp://www.linkedin.com/in/aalmiray=0A--=
=0AWhat goes up, must come down. Ask any system administrator.=0AThere are =
10 types of people in the world: Those who understand binary, and those who=
don't.=0ATo understand recursion, we must first understand recursion.=
=0A=0A----- Original Message ----=0AFrom: John D <j0h...@ya...>=0ATo=
: jso...@li...=0ASent: Tuesday, October 23, 2007 2:5=
0:35 PM=0ASubject: [json-lib-user] Groovy Usage=0A=0A=0AHi,=0A=0AI'm trying=
to use json-lib from groovy for the first time and am unable to get even t=
he simplest example to execute. Here's what I have:=0A=0A<john:scripts >gro=
ovy -v=0AGroovy Version: 1.1-rc-1 JVM: 1.5.0_07-87=0A=0A<john:scripts >cat =
test_json.groovy =0Aimport net.sf.json.groovy.JsonGroovyBuilder=0A=0Adef bu=
ilder =3D new JsonGroovyBuilder()=0Adef books1 =3D builder.books {=0A boo=
k =3D [title: "The Definitive Guide to Grails", author: "Graeme Rocher"]=0A=
book =3D [title: "The Definitive Guide to Grails", author: "Graeme Roche=
r"]=0A}=0Aprintln books1=0A=0A=0A<john:scripts >groovy test_json.groovy =0A=
Caught: net.sf.json.JSONException: null object=0A at=0A test_json.ru=
n(test_json.groovy:8)=0A at test_json.main(test_json.groovy)=0A=0A=
=0AAny ideas, am I doing something stupid?=0A=0AThanks,=0A=0AJohn=0A=0A=0A=
=0A=0A=0A=0A=0A=0A__________________________________________________=0ADo Y=
ou Yahoo!?=0ATired of spam? Yahoo! Mail has the best spam protection aroun=
d =0Ahttp://mail.yahoo.com |