try this :
return eval('(' + json + ')');
On Wed, Aug 3, 2011 at 4:43 PM, Alexander Orlov
<[email protected]>wrote:
> The JSONObject takes only JavaScriptObject as its constructor parameter.
> JavaScriptObject can be returned only by a JSNI function which I wrote:
>
> public static native JavaScriptObject parseJson(String jsonStr) /*-{
> return eval(jsonStr);
> }-*/;
>
> but when I do
>
> String json = "{\"userId\" : \"123\", \"sessionId\" : \"456\"}";
> JavaScriptObject javaScriptObject = parseJson(json);
>
>
> I get
>
> ERROR: Uncaught exception escaped.
> com.google.gwt.core.client.JavaScriptException: (SyntaxError): Unexpected
> token :
>
> -Alex
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/Z8Uk3YifLLYJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.