Why format JSON
Minified JSON is compact but hard to read. Formatting adds indentation so you can inspect the structure, and validation tells you exactly where a syntax error is.
Common JSON mistakes
- Trailing commas after the last item
- Using single quotes instead of double quotes
- Unquoted keys
- Comments, which JSON does not allow
Minify for production
When sending JSON over a network, minified output saves bandwidth. Format it while debugging, then minify it before deploying.
Frequently asked questions
Is my data sent anywhere?
No, formatting and validation happen in your browser.
Why is my JSON invalid?
The error message points to the problem. Common causes are trailing commas and single quotes.
What is the difference between format and minify?
Format adds indentation for readability. Minify removes all unnecessary whitespace.