Re: [json-lib-user] Incompatibilities in encoding JSON objects
Brought to you by:
aalmiray
|
From: Thomas W. <tho...@du...> - 2009-01-10 22:23:14
|
Hi Chaps,I have noticed a difference in the encoding of JSON objects when
the key I am encoding looks like a Javascript function. If I try the
following:
final JSONObject obj = new JSONObject();
obj.accumulate("key","value");
System.out.println(obj.toString());
It outputs:
{"key" : "value"}
If however I try this instead:
final JSONObject obj = new JSONObject();
obj.accumulate("key","function(value){}");
System.out.println(obj.toString());
It outputs:
{"key" : function(value){}}
Note the lack of quote marks around the value. Is there any way I can force
it to add quote marks around that value?
regards,
Tom
--
Thomas Williams
Java Programmer
Dubit Limited
+44 1133 947920
www.dubitlimited.com
|