Hi,

I find confusing in the tutorial (http://code.google.com/webtoolkit/
tutorials/1.6/JSON.html), this method, as it's written:

  private final native JsArray<StockData> asArrayOfStockData(String
json) /*-{
    return eval(json);
  }-*/;

It might work with the StockWatcher example json string, I haven't
tried.
But definitely it doesn't work with any json string.
Shouldn't the call to the native eval() rather be:

        /*-{
                        return eval('(' + json + ')')
                }-*/;

Until I've discovered that, I kept getting a javascript exception.
I'm new to all this, but since I've spent an aftenoon trying to
understand where the problem was, I thought what I discovered might be
helpful for others starting with JSON.

Emanuel


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to