question

portaljacker avatar image
portaljacker asked

JSON Editor altering long numbers

If you edit JSON data using the JSON button on the Title Data page and save, any longer numbers will be altered without warning.

Example:
I have an object like this:

{"Guid":8787489952239432455}

When I open the JSON editor with the button on the right, change some other value elsewhere in my JSON object (I don't touch the Guid), after saving the object looks like this:

{"Guid":8787489952239433000}

This is unacceptable, altering data without warning defeats the entire purpose of using Title Data like this. This doesn't occur when using the field directly on the Title Data page, but most people will end up using the JSON editor you've provided, and have their data altered without their knowledge.

Title Data
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

Javascript numbers with more than 16 digits will lose precision, which is by design of Javascript. In common, we can convert numbers with more than 16 digits to strings to avoid such issue.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.