JSON and data

Why can large JSON integers lose precision?

Understand JavaScript's safe-integer boundary and how to avoid silently changing API identifiers.

Where the problem starts

JSON permits numbers, but JavaScript Number uses binary floating point. After JSON.parse, integers above Number.MAX_SAFE_INTEGER may already have changed, and JSON.stringify will faithfully write the changed value. This affects order IDs, database keys, and minor-unit amounts.

How to test it

Compare 9007199254740992 and 9007199254740993 before and after parsing. For identifiers, use strings, bigint, or a decimal type in the destination system.

JSONLane's boundary

JSONLane rejects unsafe integers instead of returning a plausible-looking but changed result. Treat identifiers as strings and document that choice in the API schema.

Related tools

Sources

Last updated: 2026-08-23