Last Comment Bug 501156 - JSON.parse fails to parse an escaped string with a double backslash
: JSON.parse fails to parse an escaped string with a double backslash
Product: Firefox
Classification: Client Software
Component: General (show other bugs)
: unspecified
: All All
-- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
Depends on:
  Show dependency treegraph
Reported: 2009-06-29 10:04 PDT by Robert Schultz
Modified: 2009-06-29 11:40 PDT (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image Robert Schultz 2009-06-29 10:04:40 PDT
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/2009052808 Gentoo Firefox/3.0.10
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5 (.NET CLR 3.5.30729)

Code: JSON.parse("\"T\\wo\"");

Results in a parse exception SyntaxError.

This works perfectly fine in:
* window.eval
* GWT 1.6's JSON parsing
*'s json2.js from date 1-17-2008

Fails in:
* FF 3.5
*'s latest json2.js

Is this as designed or a bug?
If works as designed, does this mean GWT's JSON parsing and the older json2.js is/was bugged?

Reproducible: Always

Steps to Reproduce:
1. JSON.parse("\"T\\wo\"");
Actual Results:  
SyntaxError: JSON.parse

Expected Results:  
Comment 1 User image Robert Schultz 2009-06-29 10:14:06 PDT
I updated the test page with the eval snippet from the RFC

It also works correctly. Giving the output of: Two
Comment 2 User image Robert Schultz 2009-06-29 11:03:13 PDT
This is by design according to Douglas Crockford here:

Marking this bug as INVALID.

Note You need to log in before you can comment on or make changes to this bug.