circlecell / jsonlint.com

[OLD] Please go to new source, link below.

Home Page:https://github.com/circlecell/jsonlint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Result of parsing big ints with package vs. jsonlint.com

buhrmann opened this issue · comments

Hi,
Not reporting a bug really, just curious about a difference between results when using the jsonlint package directly vs. the app at jsonlint.com. Specifically, they seem to treat big ints (int64) differently. E.g. echo '{"a": 822215679726100480}' | jsonlint returns

{
  "a": 822215679726100500
}

I.e., it incorrectly rounds big ints, as one would expect from a naive implementation in js.

However, when I paste the same string into jsonlint.com, the output is much nicer:

{
    "a": 822215679726100480
}

This is the result I'd hope for (unless actually loading the data into a js process, but I'm working in python). I'm asking because other pieces of software (e.g. VS Code plugins using jsonlint as a formatter) may benefit from handling big ints correctly, and could perhaps port whatever "trick" is used in jsonlint.com...

A library used at jsonlint.com is developed by other people, so I'm non-competent here :(
You can use the same library used on the website, it also has CLI https://www.npmjs.com/package/jsonlint-mod