Closed Bug 1510136 Opened 7 years ago Closed 7 years ago

JSON.parse not correct when decoding Special json string

Categories

(Core :: JavaScript Engine, defect)

63 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: maorenmy, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36 Steps to reproduce: decoding json string: JSON.parse('{"id":15793596764604416,"tenantId":"qiushi6","createTime":1543269513000,"updateTime":null,"nodes":[{"id":15793596808644609,"name":"开始","workflowId":15793596764604416,"type":"tflowstart","x":100,"y":200,"remark":null,"reserved":false},{"id":15793596808644608,"name":"时间","workflowId":15793596764604416,"type":"tflowtime","x":200,"y":200,"remark":null,"reserved":false}],"connects":[{"id":15793596808644610,"workflowId":15793596764604416,"source":15793596808644609,"target":15793596808644608,"position":0,"name":null,"reserved":true,"sourceNode":null,"targetNode":null}],"reserved":false}') Actual results: result object { "id": 15793596764604416, "tenantId": "qiushi6", "createTime": 1543269513000, "updateTime": null, "nodes": [ { "id": 15793596808644608, "name": "开始", "workflowId": 15793596764604416, "type": "tflowstart", "x": 100, "y": 200, "remark": null, "reserved": false }, { "id": 15793596808644608, "name": "时间", "workflowId": 15793596764604416, "type": "tflowtime", "x": 200, "y": 200, "remark": null, "reserved": false } ], "connects": [ { "id": 15793596808644610, "workflowId": 15793596764604416, "source": 15793596808644608, "target": 15793596808644608, "position": 0, "name": null, "reserved": true, "sourceNode": null, "targetNode": null } ], "reserved": false } Expected results: expected result { "id": 15793596764604416, "tenantId": "qiushi6", "createTime": 1543269513000, "updateTime": null, "nodes": [ { "id": 15793596808644608, "name": "开始", "workflowId": 15793596764604416, "type": "tflowstart", "x": 100, "y": 200, "remark": null, "reserved": false }, { "id": 15793596808644609, "name": "时间", "workflowId": 15793596764604416, "type": "tflowtime", "x": 200, "y": 200, "remark": null, "reserved": false } ], "connects": [ { "id": 15793596808644610, "workflowId": 15793596764604416, "source": 15793596808644608, "target": 15793596808644609, "position": 0, "name": null, "reserved": true, "sourceNode": null, "targetNode": null } ], "reserved": false }
15793596808644609 is not representable with JS number value, and rounded to near value. https://tc39.github.io/ecma262/#sec-terms-and-definitions-number-value > 4.3.20 Number value > primitive value corresponding to a double-precision 64-bit binary format IEEE 754-2008 value the result is consistent across browsers.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: