What does the JSON formatter do?
It validates JSON strictly against RFC 8259, the JSON standard, and points to the exact line and column of the first error, with a hint for the usual mistakes: trailing commas, comments, single quotes, unquoted keys, NaN or leading zeros.
Formatting is lossless. Unlike JSON.parse followed by JSON.stringify, it never rounds numbers past 2^53, turns 1e400 into null, rewrites 1.0 as 1, decodes escapes or drops duplicate keys; it only changes whitespace (and key order, if you ask). Duplicate keys and numbers JavaScript would round are flagged.
How to use this tool
- Paste JSON into the input. It is checked as you type.
- Choose an indent (2 spaces, 4 spaces or tab) and whether to sort keys.
- Copy the pretty or minified result, or use Prettify / Minify to rewrite the input.
Frequently asked questions
Why not just use JSON.stringify?
Because it changes data: 12345678901234567890 becomes 12345678901234567000, 1e400 becomes null and only the last of two duplicate keys survives. This formatter keeps every value as written.
Can I format JSON in other stbox tools?
Yes. Any stbox text box that holds a JSON object or array shows Format, Minify and Copy buttons in its corner.
Is JSON uploaded?
No. Formatting and validation are client-side only.