Skip to content

Format JSON Without Losing Large Integers

Formatting should make a payload readable without changing its identifiers. Test number preservation before using an online formatter on 64-bit database IDs or precise decimal values.

By Utilify team · Updated

Where the precision loss happens

JavaScript Number represents integers exactly only up to 9,007,199,254,740,991. Parsing a larger numeric ID with JSON.parse can round it before the formatter writes anything. Once rounded, a later pretty-print cannot reconstruct the original digits.

{"id":9007199254740993,"amount":1.2300}

Preserved:
{
  "id": 9007199254740993,
  "amount": 1.2300
}

Choose a formatter that preserves number tokens

Utilify’s JSON Formatter copies each numeric token from the input instead of converting it through JavaScript Number. Large integers, decimal trailing zeros and exponent notation remain as written. Indentation and optional key sorting change the presentation, not those number tokens.

Paste the example into the formatter and compare both the ID and amount. Use the validator’s warnings to find integers that downstream JavaScript consumers may round. Formatting safely does not change how another application parses the file.

Protect the complete data pipeline

If you control the API contract, consider transmitting identifiers as strings and use an appropriate numeric type when arithmetic is required. Do not automatically quote numbers in someone else’s payload: changing their type can break validation or application behavior. Duplicate keys also need review even when their syntax is accepted.

Sources and standards

All guides →