Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

reformatting long integer issue #3

Open
kumarkiranm opened this issue Jul 7, 2011 · 2 comments
Open

reformatting long integer issue #3

kumarkiranm opened this issue Jul 7, 2011 · 2 comments

Comments

@kumarkiranm
Copy link

When I place a request of reformat and validate my json which contains a long integer, jsonlint is displaying the wrong output in reformatted json.

ex:
original: {"response":{"timestamp":1310033637419,"body":{"session":4261667034108713961},"type":"xxxxxxxx","version":"0.1.0.0"}}

reformatted:
CONVERTED:
{
"response": {
"timestamp": 1310033637419,
"body": {
"session": 4261667034108714000
},
"type": "xxxxxxxx",
"version": "0.1.0.0"
}
}

In the above example, "session" value is being modified by jsonlint while reformatting. not returning the original value.

Cheers,
KK

@umbrae
Copy link
Owner

umbrae commented Jul 7, 2011

To clarify, this has to do with maximum integer size in javascript. If you enter into the console: console.log(4261667034108713961), 4261667034108714000 is returned.

Ideally, we'd detect if a number passed is greater than the maximum integer size and issue a warning. As a simpler workaround, we could just use the string-based reformatter so that javascript number parsing doesn't get involved.

@kumarkiranm
Copy link
Author

Either issuing a warning or parsing as a string if its greater than the max integer size will do. thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants