JSON integers past 2^53

CodeMoment · Updated 2026-10-31

JSON.parse uses JavaScript numbers. Integers bigger than 9007199254740991 (2^53 - 1) are not exact, so 12345678901234567890 becomes 12345678901234567000.

If you only want to format or inspect the text, parse it with a lossless parser and write the original digits back out. The JSON Formatter on this site does that in the browser and does not upload the input.

The converters beside JSON keep those digits too. CSV ↔ JSON writes every cell as a string, so 001 and a long digit string stay as typed. TOML ↔ JSON keeps an integer larger than 2^53 - 1 digit for digit. Neither page uploads the text.

JSON to Go does not keep those digits as text. The same integer becomes a Go int, and the struct only adds a comment that JSON did not keep it exactly.

This does not make the value safe to do math on. Any later JSON.parse in application code still rounds it. Treat the id as a string if the API can change.