JSON Formatter & Validator
Paste JSON, then pretty-print it, minify it, or just check that it is valid — with the exact line and column when it is not. Free, no sign-up, no uploads.
How to use
- Paste or type your JSON into the top box.
- Click Format to pretty-print it with the indent width you chose, Minify to strip all whitespace, or Validate only to check it without changing anything.
- If the JSON is invalid, the error message tells you the line and column of the problem. Fix it and run again.
- Use Copy result to copy the output to your clipboard.
Example
Minified API response {"user":{"id":42,"roles":["admin","editor"]},"active":true} becomes, with a 2-space indent, a readable tree where every key sits on its own line — the same data, just shaped for human eyes. Minifying a formatted document does the reverse and typically cuts 20–40% of its size.
FAQ
Is my JSON uploaded to a server?
No. Formatting and validation run entirely in your browser with JavaScript. Nothing is sent anywhere, so it is safe for API responses, config files and tokens.
Why does it reject trailing commas and comments?
Strict JSON does not allow them — they belong to JavaScript and JSON5, not JSON. Most APIs and config parsers reject them too, so catching them here saves a failed request later.
How are error positions calculated?
The parser reports the character position of the first error, and this tool converts it into a line and column number and shows the offending line, so you can jump straight to the problem.
Does key order change when formatting?
No. JSON.stringify preserves the order in which keys appear in the parsed object, which for text input is the order you pasted them in.