JSON.parse fails to parse an escaped string with a double backslash

VERIFIED INVALID

Status

()

Firefox
General
VERIFIED INVALID
8 years ago
8 years ago

People

(Reporter: Robert Schultz, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

8 years ago
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
(Reporter)

Comment 1

8 years ago
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
(Reporter)

Comment 2

8 years ago
This is by design according to Douglas Crockford here: http://tech.groups.yahoo.com/group/json/message/1286

Marking this bug as INVALID.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INVALID

Updated

8 years ago
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.