[Webkit-unassigned] [Bug 170442] Safari 10.1 JSON.parse returns incorrect object for numeric keys with decimal values
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Apr 26 09:01:27 PDT 2017
https://bugs.webkit.org/show_bug.cgi?id=170442
PiwEL <webkit at piwel.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |webkit at piwel.fr
--- Comment #8 from PiwEL <webkit at piwel.fr> ---
It's the same problem even when the first key isn't 0, for JSON.parse and JSON.stringify.
JSON.stringify({ 8: 13.2, 111544: 132})
> "{\"0\":null,\"1\":null,\"2\":null,\"3\":null,\"4\":null,\"5\":null,\"6\":null,\"7\":null,\"8\":13.2,\"111544\":132}"
If these are parseable to integers, this doesn't happen either.
JSON.stringify({ 8: 132, 111544: 132})
> "{\"8\":132,\"111544\":132}"
And in the other way :
JSON.parse("{\"8\":13.2,\"111544\":132}");
> {0: NaN, 1: NaN, 2: NaN, 3: NaN, 4: NaN, 5: NaN, 6: NaN, 7: NaN, 8: 13.2, 111544: 132}
I guess tests for theses cases should also be added, but I'm sorry, I'm new here and I don't know how to do it.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170426/3555a7ab/attachment-0001.html>
More information about the webkit-unassigned
mailing list