PDA

View Full Version : JSON string From servlet



dhanabalan
10 May 2009, 10:33 PM
Dear all,
When i am doing object.toJSONString i got following format
{"total":"1","data":[{"name":"XYZ","number":"12345"}]}

Please clarifiy this is correct or instead of Double quote need single quote...I don't know....anyone pls tel me...How i will change double quote to single quote...

JSONArray arr = new JSONArray();
JSONObject obj1 = new JSONObject();

obj1.put("number", "12345");
obj1.put("name", "XYZ");

arr.add(obj1);

JSONObject obj2 = new JSONObject();
obj2.put("data",arr);

JSONObject obj3 = new JSONObject();
obj3.put("total","1");
obj3.put("data",arr);

out.println(obj3..toJSONString());


:((

kolli
11 May 2009, 4:28 AM
I guess double quotes are fine.

dhanabalan
12 May 2009, 9:39 PM
Thanks,
But, by using JSONReader not loaded into grid.....