Open Bug 1431808 Opened 7 years ago Updated 17 days ago

long Integers rounding last two digits to '00' in JSON view

Categories

(DevTools :: JSON Viewer, defect, P2)

defect

Tracking

(Not tracked)

People

(Reporter: jrconlin, Unassigned)

References

(Depends on 1 open bug)

Details

Attachments

(1 file)

Attached image round_bug.jpg.png
When displaying: {"last": true, "index": 1516340399466235648, "messages": [{"timestamp": 1516340399466235648, "data": "asdf"}]} I'm seeing the last two digits of "index" and "timestamp" being set to "00". See attached screenshot.
This is a JS limitation: 1516340399466235648 > Number.MAX_SAFE_INTEGER 1516340399466235648 === 1516340399466235600 From RFC 7159 page 7, > This specification allows implementations to set limits on the range > and precision of numbers accepted. Since software that implements > IEEE 754-2008 binary64 (double precision) numbers [IEEE754] is > generally available and widely used, good interoperability can be > achieved by implementations that expect no more precision or range > than these provide, in the sense that implementations will > approximate JSON numbers within the expected precision. A JSON > number such as 1E400 or 3.141592653589793238462643383279 may indicate > potential interoperability problems, since it suggests that the > software that created it expects receiving software to have greater > capabilities for numeric magnitude and precision than is widely > available. > > Note that when such software is used, numbers that are integers and > are in the range [-(2**53)+1, (2**53)-1] are interoperable in the > sense that implementations will agree exactly on their numeric > values. If you need more precision, use strings.
Ah. I get that it's a javascript limitation. It's just that it's appearing inside of the built in JSON view. For folks (like me) that might not be aware of the limitation, it might be good to indicate that there was some numeric truncation going on (other than padding zeros).
The native JSON parser does not provide truncation info. It has already been suggested to add a custom parser, but I'm afraid it will hurt performance in big documents. The bottleneck would still be react, of course.
Product: Firefox → DevTools

I think this bug is grave enough to change the devtools.jsonview.enabled default to "false", and to point users to other json viewer addons which don't have this bug.

Judging how this is constantly popping up, perhaps it does deserve some priority?
If the built-in JSON parser doesn't provide overflow warnings, perhaps it should? (Where would one file a request like that?)
Or perhaps Moz could re-.stringify() the resultant JS value into JSON and thus verify if parsing succeeded?

Still seeing this one in the latest Firefox 98.0.2 for Mac. Quite surprising, actually.

Severity: normal → S3
Priority: -- → P3

The severity field for this bug is relatively low, S3. However, the bug has 11 duplicates.
:Honza, could you consider increasing the bug severity?

For more information, please visit auto_nag documentation.

Flags: needinfo?(odvarko)

This should be fixed, increasing priority.

Flags: needinfo?(odvarko)
Priority: P3 → P2

Simple test case with instructions available at: http://janodvarko.cz/tests/bugzilla/1431808/

Has STR: --- → yes
Duplicate of this bug: 1815226

From bug 1815226 comment #5

There's a proposal to expose the raw text to a JSON.parse function so we could transform those numbers into BigInt (See Bug 1658310)

See Also: → 1658310
Duplicate of this bug: 1840240
Duplicate of this bug: 1847897

Looks like Bug 1855468 is on its way, let's see if we could use it to fix this issue

Depends on: 1855468
Duplicate of this bug: 1879468
Duplicate of this bug: 1894646
Duplicate of this bug: 1919189
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: