prototypejs / prototype

Prototype JavaScript framework
http://prototypejs.org/
Other
3.53k stars 639 forks source link

[Old Version] Prototype 1.6.0.3 JSON stringify turns array to string #327

Closed jasonpang closed 7 years ago

jasonpang commented 7 years ago

The old implementation of JSON.stringify() turns an array into a string, so that if you call JSON.parse() on the JSON expecting to get an array, you actually get a string back.

JSON.parse(JSON.stringify(['hi']));
// "['hi']", a String, not an Array

I thought posting this issue here would help other developers that might run into the same issue.

This bug was fixed in Prototype 1.7.0 (http://prototypejs.org/download).

JSFiddle Demo: https://jsfiddle.net/vexagpgf/1/