JSON Formatter
Turn valid JSON text into readable indentation without running it through JavaScript object materialization. This formatter preserves source number lexemes such as large integers, -0, and exponent notation.
Format Valid JSON Text
What The Formatter Changes
The tokenizer validates one complete RFC 8259 JSON value, then rewrites only insignificant whitespace with two-space indentation. Object, array, string, number, true, false, and null roots are accepted.
Formatting is not repair, schema validation, or API-contract validation. A malformed trailing comma, comment, or unquoted key produces an error instead of guessed output.
Lexical Preservation Checks
| Input | Formatter behavior | Why it matters |
|---|---|---|
| 9007199254740993 | Digits remain unchanged | Avoids JavaScript Number rounding |
| -0 | Minus sign remains | Preserves source number spelling |
| 1e+2 | Exponent spelling remains | Avoids parse/stringify normalization |
| {"a":1,"a":2} | Both members remain with a warning | Duplicate names are valid syntax but risky for consumers |
Use It For Review, Not Repair
- Inspect nested API responses and configuration files.
- Keep the original payload when downstream behavior depends on duplicate names or numeric limits.
- Use JSON Validator when the primary task is diagnosing syntax and interoperability warnings.
Questions About This Tool
Yes. Strings, numbers, true, false, and null are valid JSON values as well as arrays and objects.
No. It proves only that the input is syntactically valid under the supported JSON parser profile.
RFC 8259 syntax permits repeated names, but software may keep the first value, keep the last value, report an error, or expose every pair.