[json-lib-user] Exception while parsing JSON
Brought to you by:
aalmiray
From: Haritha J. <har...@ya...> - 2008-01-17 21:18:37
|
Hi All , I have a json string defined below which i am trying to convert into a java object TestObject.java String jsonStr="{\"id\":\"123456\",\"name\":\"untitled note\",\"json\":{\"name\":\"hjsgdfhjgsdfh\"},\"size\":({width:941,height:480})}"; JsonConfig jsonConfig = new JsonConfig(); jsonConfig.setRootClass(TestObject.class); jsonObject = JSONObject.fromObject(jsonStr,jsonConfig); Object object = JSONObject.toBean(jsonObject ,TestObject.class); When i execute this code i get this exception ERROR - RequestCycle.logRuntimeException(1328) | Unquotted string '(' net.sf.json.JSONException: Unquotted string '(' at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:445) at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:913) at net.sf.json.JSONObject._fromString(JSONObject.java:1102) at net.sf.json.JSONObject.fromObject(JSONObject.java:175) at com.splashnote.web.pages.Test.<init>(Test.java:41) Can someone tell me how i can avoid this. The "size" parameter value is treated as what object in json-lib? Thanks Haritha ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping |