Re: [json-lib-user] Quick Question on JSON
Brought to you by:
aalmiray
|
From: Haritha J. <har...@ya...> - 2007-12-11 21:00:06
|
Hi Andres=0A=0AThe TextField bean looks like this=0Apublic class TextField(=
){ =0A private Long parentId;=0A private Long textFieldId;=0A priva=
te String JSON;=0A}=0A=0AAfter executing the code JSONObject jsonObj =3D JS=
ONObject.fromObject( textField, jsonConfig ); , i try to print this object=
'jsonObj" and it prints the name value pair( of JSON Property) with quotes=
=0A=0A{"parentId":678,"textFieldId":111,"JSON":"{'sizeWidth':620,'text':'=
=93[Winning the Nobel Peace Prize] ','positionLeft':20,'style':'left:20px;t=
op:100px;width:620px;height:100px;','positionTop':100,'name':'','cssClass':=
'','objectType':'TextObject','sizeHeight':100}"}=0A=0AIf it was converting =
this 'JSON' property to JSONObject internally, wont it print as=0A=0A"JSON"=
:=0A{"parentId":678,"textFieldId":111,"JSON":{'sizeWidth':620,'text':'=93[W=
inning=0Athe Nobel Peace Prize]=0A','positionLeft':20,'style':'left:20px;to=
p:100px;width:620px;height:100px;','positionTop':100,'name':'','cssClass':'=
','objectType':'TextObject','sizeHeight':100}}=0Awithout the quotes on the =
value.=0A=0APlease correct me if i got it wrong=0A=0AI am using the json-li=
b-2.1 for jsd 1.5 version.=0AHaritha=0A=0A=0A=0A----- Original Message ----=
=0AFrom: Andres Almiray <aal...@ya...>=0ATo: Haritha Juturu <haritha.=
ju...@ya...>; jso...@li...=0ASent: Tuesday, Dec=
ember 11, 2007 12:27:12 PM=0ASubject: Re: [json-lib-user] Quick Question on=
JSON=0A=0A=0AHi Haritha,=0A=0AAre you sure the contents of the named prope=
rty ('JSON') are not automatically converted into a JSONObject ? it looks t=
o me like it is a well formed json string, if so it should be converted aut=
omatically when you call fromObject() at top level.=0A=0ACan you please tel=
l us which version of Json-lib are you testing with?=0A=0ARegards,=0AAndres=
=0A=0A----- Original Message ----=0AFrom: Haritha Juturu <haritha.juturu@ya=
hoo.com>=0ATo: jso...@li...=0ASent: Tuesday, Decembe=
r 11, 2007 12:16:36 PM=0ASubject: [json-lib-user] Quick Question on JSON=0A=
=0A=0AHi Everyone=0AI have a line of code=0AJSONObject jsonObj =3D JSONObje=
ct.fromObject( textField, jsonConfig ); =0Awhich produces this JSON string=
=0A=0A{"parentId":678,"textFieldId":111,=0A"JSON":=0A"{'sizeWidth':620,'tex=
t':'=93[Winning the Nobel Peace Prize]','positionLeft':20,'style':'left:20p=
x;top:100px;width:620px;height:100px;','positionTop':100,'name':'','cssClas=
s':'','objectType':'TextObject','sizeHeight':100}"=0A}=0A=0Anow if i want t=
he property "json" whose value is a string=0A =93[Winning the Nobel Peace=
=0APrize]','positionLeft':20,'style':'left:20px;top:100px;width:620px;heigh=
t:100px;','positionTop':100,'name':'','cssClass':'','objectType':'TextObjec=
t','sizeHeight':100}"=0A=0Ato be converted to a json object .... is there a=
ny API methods i can use.i am unable to locate any.=0A=0Ai.e my output sho=
uld look like =0A{"parentId":678,"textFieldId":111,=0A"JSON": this value is=
not a string anymore=0A{'sizeWidth':620,'text':'=93[Winning=0Athe Nobel Pe=
ace=0APrize]','positionLeft':20,'style':'left:20px;top:100px;width:620px;he=
ight:100px;','positionTop':100,'name':'','cssClass':'','objectType':'TextOb=
ject','sizeHeight':100}=0A}=0A=0AI have a constraint that i need to do this=
manipulation on the jsonObj .=0A=0AThanks=0AHaritha=0A=0A=0A=0A=0A=0A=0A =
Be a better friend, newshound, and =0Aknow-it-all with Yahoo! Mobile. =
Try it now.=0A=0A=0A=0A=0A=0A Be a better friend, newshound, and =0Akn=
ow-it-all with Yahoo! Mobile. Try it now.=0A=0A=0A=0A=0A=0A _________=
___________________________________________________________________________=
=0ANever miss a thing. Make Yahoo your home page. =0Ahttp://www.yahoo.com/=
r/hs |