Closed
Bug 476480
Opened 16 years ago
Closed 16 years ago
JSON.stringify doesn't serialize array in object properly
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: yorickvanpelt, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b2) Gecko/20081201 Firefox/3.1b2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b2) Gecko/20081201 Firefox/3.1b2
When trying to serialize an array inside an object, it is made a string instead of an array.
Reproducible: Always
Steps to Reproduce:
1.execute JSON.stringify({a:[1,2,3]})
Actual Results:
returns {"a":"[1, 2, 3]"}
Expected Results:
returns {"a": [1, 2, 3]}
Reporter | ||
Updated•16 years ago
|
Flags: blocking-firefox3.1?
Reporter | ||
Comment 1•16 years ago
|
||
Note: with some further testing, this only seems to happen when prototype.js is loaded.
Reporter | ||
Updated•16 years ago
|
Flags: blocking-firefox3.1?
Updated•16 years ago
|
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Comment 2•16 years ago
|
||
Related to bug 469627 ?
/be
Comment 3•16 years ago
|
||
(In reply to comment #2)
> Related to bug 469627 ?
I don't think so. It would help to know whether IE8 suffers a similar incompatibility.
Reporter | ||
Comment 4•16 years ago
|
||
Possibly related to bug 465371 , as prototype adds functions to Array.prototype
Reporter | ||
Comment 5•16 years ago
|
||
Ah, Prototype defines an Array.prototype.toJSON method, which returns a json string. Firefox expects that method to return an object, and stringifies the string instead.
Updated•16 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•