JSON Formatter
Pretty-print JSON. Choose spaces or tabs, indent width, and whether to repair common mistakes.
Rated 4.8 out of 5 based on 976 reviews
How to format JSON
- Paste JSON into Input.
- Choose Space or Tab. For spaces, set indent from 1 to 10.
- Leave Repair on if the paste may include trailing commas or comments.
- Copy or download the pretty-printed result.
JSON
Data interchange format (RFC 8259)
| This tool changes | Whitespace outside strings, after a successful parse |
|---|---|
| Repair | Optional: comments, trailing commas, single quotes, unquoted keys |
What this formatter does
It parses JSON and writes it back with indentation. Values stay equivalent after a successful parse. With Repair on, trailing commas, // and /* */ comments, single-quoted strings, and unquoted keys are normalized first.
To remove whitespace instead, use the JSON minifier. Both live under format tools.
What JSON can contain
JSON (RFC 8259) holds objects, arrays, strings, numbers, true, false, and null. It is not JavaScript. Repair can accept some JavaScript-like syntax and rewrite it into JSON. It is not a full JavaScript parser.
How errors are handled
If parsing still fails after repair (or with repair off), the output clears and the status shows the parser message. You will not get a half-formatted document that looks valid.