[json-lib-user] Parsing problem
Brought to you by:
aalmiray
|
From: zapping z. <zap...@ya...> - 2009-06-02 16:04:46
|
Hi,
I have a json string that is returned from a service like
{success:"true",code:"200",dataType:"object",objClass:"Message",data:{text:"The room is free. You can start a meeting"}}
When i try to parse it
JSONObject jsonResponse = (JSONObject)JSONSerializer.toJSON(strResponse);
I get an Invalid exception. But the same response string i am able to parse with javascript but not in Java. Tried replacing the quotes with
strResponse = strResponse.replaceAll("\"", "\\\\\"");
But still throws invalid exception. But when i try it this way with a constant it parses
String strResponse = "{success:\"false\",code:\"300\",dataType:\"object\",objClass:\"Message\",data:{text:\"Unparseable date: 'June 03 2009 11:15:00 AM EDT'\"}}";
JSONObject jsonResponse = (JSONObject)JSONSerializer.toJSON(strResponse);
But not directly from the service.
Can you help me out.
Thx,
Zaps
|