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)

x86
Windows Vista
defect
Not set
normal

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]}
Flags: blocking-firefox3.1?
Note: with some further testing, this only seems to happen when prototype.js is loaded.
Flags: blocking-firefox3.1?
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Related to bug 469627 ? /be
(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.
Possibly related to bug 465371 , as prototype adds functions to Array.prototype
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.
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.