Re: parseLenient and parseStrict on newer browsers [was Re: seemingly misleading verbiage in the documentation...]

2011-04-01 Thread Thomas Broyer
If you know that your JSON is wellformed JSON (and not just the more liberal JavaScript's literal object notation), then use parseStrict. Only use parseLenient if you know your JSON isn't actually JSON (i.e. from a legacy server). That should be the rule IMO, independently from performance. It

Re: seemingly misleading verbiage in the documentation...

2011-03-31 Thread Thomas Broyer
Can't you have a look at the javadoc and the source code? See http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/json/client/JSONParser.html (in other words, the doc is outdated) -- You received this message because you are subscribed to the Google Groups Google Web

Re: seemingly misleading verbiage in the documentation...

2011-03-31 Thread karthik reddy
Any thoughts on this would be much appreciated. I am trying to validate my understanding of JSONParser class and also highlight the misleading verbiage in the documentation. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this

Re: seemingly misleading verbiage in the documentation...

2011-03-31 Thread karthik reddy
Thanks Thomas. In fact, I did look at the javadoc, and even the javadoc has kinda ambiguous verbiage . More precisely, parseStrict's description is right on : Evaluates a JSON string and returns its JSONValue representation. Where possible, the browser's JSON.parse function is used. For older

Re: seemingly misleading verbiage in the documentation...

2011-03-31 Thread Thomas Broyer
parseLenient *only* uses eval(), not only as a fallback. This is because JSON is stricter than JavaScript's object literal notatio: in JSON, object property names must be quoted; JS can include comments, etc. JSON.parse cannot parse those JS literal objects that do not quote property names

parseLenient and parseStrict on newer browsers [was Re: seemingly misleading verbiage in the documentation...]

2011-03-31 Thread karthik reddy
parseLenient *only* uses eval(), not only as a fallback. . I went into the source code and took a look at the parseLenient method. You are correct. parseLenient always uses eval(). The following is the code snippet that confirmed this fact for me: