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
Status: VERIFIED INVALID
:
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
:
:
Mentors:
http://www.telparia.com/json_backslas...
Depends on:
Blocks:
  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:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Robert Schultz 2009-06-29 10:04:40 PDT
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) 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
* json.org's json2.js from date 1-17-2008

Fails in:
* FF 3.5
* json.org'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 json.org json2.js is/was bugged?

Reproducible: Always

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

Expected Results:  
Two
Comment 1 Robert Schultz 2009-06-29 10:14:06 PDT
I updated the test page with the eval snippet from the RFC
http://www.ietf.org/rfc/rfc4627.txt?number=4627

It also works correctly. Giving the output of: Two
Comment 2 Robert Schultz 2009-06-29 11:03:13 PDT
This is by design according to Douglas Crockford here: http://tech.groups.yahoo.com/group/json/message/1286

Marking this bug as INVALID.

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