JSON Formatter and Validator
Format, minify and validate JSON with precise error locations, optional key sorting and a structure summary.
Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.
What the JSON Formatter and Validator does
The JSON formatter and validator on this page will format, minify and validate JSON with precise error locations, optional key sorting and a structure summary. Paste your text in, pick the options you need, and copy the result straight back out. It is most often used for making an unreadable minified API response legible. More utilities in this area are collected on FreeToolsWorld.org.
How to use it
- Paste your JSON into the input box.
- Choose pretty-printed or minified output.
- If the JSON is invalid, the exact line and column of the problem is shown with a caret.
- Copy the formatted result or download it.
How it works
Validation uses the browser's own JSON.parse, so what passes here is exactly what will parse in JavaScript. The error message is enhanced with a line and column position and a caret pointing at the offending character, because "Unexpected token } in JSON at position 847" is not much help on its own.
The most frequent causes of invalid JSON are a trailing comma after the last item, single quotes instead of double quotes, unquoted keys, and a comment — none of which the JSON specification allows, even though JavaScript object literals permit most of them.
Everything is parsed and re-serialised locally. That matters more for JSON than for most formats: configuration files, API responses and database rows routinely contain credentials, tokens and personal data, and pasting those into a server-side formatter hands them to whoever runs it.
When to use it
- Making an unreadable minified API response legible.
- Finding the exact position of a syntax error in a config file.
- Minifying JSON before embedding it somewhere size-sensitive.
Common mistakes to avoid
- Leaving a trailing comma after the final array or object entry.
- Using single quotes — JSON requires double quotes for both keys and string values.
- Including comments, which JSON does not support at all.
Frequently asked questions
Why does my JSON fail with a trailing comma?
Because the JSON specification does not allow one, even though JavaScript object and array literals do. Remove the comma after the last element. JSON5 and JSONC permit them, but standard parsers do not.
Is my data sent anywhere?
No. Parsing and formatting both run in your browser using the built-in JSON parser. Nothing is transmitted, which is why it is safe to paste a response containing tokens or personal data.
What is the difference between pretty and minified?
Pretty adds indentation and line breaks for human reading. Minified strips every optional space, which reduces transfer size. Both represent exactly the same data.