On 8/3/2011 8:04 AM, Alexander Orlov wrote:
Thx!

GWT has a pretty idiosyncratic style!

It's not up to GWT, it's up to the browser to evaluate the string. Take a look at the source code.

Btw, were my assumptions how to construct a JSONObject right?

Sort of.

The JSON spec indicates that you don't quote numbers, OTOH, your application may warrant those quotes.

Other points:
o You want to use a JavaScript Object as the destination of the parse object. Here I deliberately use saveEval because I trust the source of the string.
JSObject = JsonUtils.safeEval(source);

where JSOBject is a class that extends JavaScriptObject and optionally implements an interface. Using the interface allows you to mock the JSO.

o You want to use the JSObject as the source of the associated string. The round trip should be idempotent.

 @Override
 public final String export() {
   return new JSONObject(this).toString();
 }

o example:
"{\"activityName\":\"L\", \"id\":12, \"predecessorList\":[11,10], \"likely\":0, \"worst\":0, \"best\":0}"

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