How to format JSON safely
Format a document
- Paste the complete JSON text.
- Choose two spaces, four spaces, tabs or minified output.
- Select Format JSON and fix any reported line and column.
- Review duplicate-key warnings before copying the result.
What is preserved
Whitespace is replaced, but string escapes, number lexemes and object key order remain exactly as entered. Large integers such as 9007199254740993 are not converted to JavaScript numbers.
Duplicate object keys remain in the output and are reported with their location. Many downstream parsers keep only one value, so resolve them deliberately.
Validation limits
- Rejects invalid escapes, control characters, trailing commas, truncated input and invalid JSON number grammar.
- Does not execute code, fetch URLs, apply remote schemas or provide a general-purpose IDE.
JSON formatter FAQ
Does it change large integers?
No. It rearranges validated tokens and never converts number tokens to floating-point values.
Are duplicate keys deleted?
No. They are preserved and listed as warnings because automatic deletion could change meaning.
Can the root be a string or number?
Yes. Any JSON value is valid at the top level.