[json-lib-user] Problem with special characters in JSON string keys
Brought to you by:
aalmiray
From: Florian S. <flo...@gm...> - 2007-05-28 15:22:55
|
Hi all, I am facing the following problem while using json-lib: {"array" : [1,2] } When I try to convert this JSON string into a Java object, I get no errors at all; everything works fine. However, trying to convert this JSON string {"array.java" : [1,2]} into a Java object yields an error: Exception in thread "main" net.sf.json.JSONException: java.lang.NoSuchMethodException: Unknown property 'array' at net.sf.json.JSONObject.toBean(JSONObject.java:543) Caused by: java.lang.NoSuchMethodException: Unknown property 'array' at org.apache.commons.beanutils .PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java :1112) at org.apache.commons.beanutils .PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java :1619) at org.apache.commons.beanutils .PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677) at org.apache.commons.beanutils .PropertyUtils.setProperty(PropertyUtils.java:559) at net.sf.json.JSONObject.setProperty(JSONObject.java:781) at net.sf.json.JSONObject.setProperty(JSONObject.java:761) at net.sf.json.JSONObject.toBean(JSONObject.java:518) It seems that keys that contain period cannot be fully parsed; only the string up to the first period is taken into account. Any ideas why? Thanks in advance, Florian |