I forgot to mention that the problem I am having is specifically
related to the single quote in the string. It seems the native JSON
parsers have trouble with single quotes.

On May 26, 5:25 pm, zurielb <zuri...@gmail.com> wrote:
> So, I'm at a little bit of a conundrum here.
> The past couple of days I have been trying to figure out a bug on the
> RC2 release of prototype related to the native JSON.parse
> functionality just introduced on 1.7.
> I am using the AJAX.Request API to get a url and I am getting valid
> JSON back. I want to do a simple transport.responseText.evalJSON() on
> the response.
> Well, it was working fine on 1.6.1, but upon switching to 1.7 RC2 on
> my development build I noticed this bit was broken.
> What happens is that there seems to be a bug in Safari and Firefox's
> implementation of JSON.parse specifically related to the evaluation of
> a response with escape characters. Here's a quick example:
> {"test":"This is \na new line and a \rcarriage return\'s and a
> \"double quote"}
> Unless I am confused, the above text should be considered valid JSON.
> All special characters are escaped. This JSON evaluates correctly with
> the 1.6.1 build of Prototype since it uses an EVAL based JSON
> evaluation. The 1.7 build switches dynamically between the EVAL
> version and the native JSON.parse version if the browser supports it.
> Unfortunately the string above breaks when it is evaluated by the
> native parser in Safari and Firefox (Surprisingly Internet Explorer 8
> evaluates with no problems). Right now I just disabled the native
> functionality on my local build of Prototype by removing the
> NATIVE_JSON_PARSE_SUPPORT switch and everything is working fine again.
> So I have a couple of questions:
>  - If this is indeed a bug, should I submit bug requests to Safari and
> Firefox to fix this or am I missing something?
>  - Should prototype 1.7 provide control on whether or not it should
> use JSON.parse (if this is indeed a bug) and I want to continue using
> the EVAL version of the evalJSON() function.

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to