About JSON Formatter & Validator
JSON Formatter turns a wall of compressed JSON into clean, indented, readable data. It also validates it, points to the exact line and column of any error, and lets you explore large documents in a collapsible tree.
How it works
Your input is parsed with the browser's strict, standards-compliant JSON parser. If it's valid, it's re-serialized with the indentation you choose (2 spaces, 4 spaces or tabs), minified to a single line, or rebuilt with keys sorted alphabetically. If it's invalid, the error position is converted into a line and column so you can jump straight to the problem.
The Repair button handles the mistakes people make most often when JSON is written by hand or copied from JavaScript: trailing commas, single quotes, unquoted keys and comments. After repairing, the result is validated again.
Common JSON errors
- Trailing commas:
[1, 2, 3,]is valid JavaScript but not valid JSON. - Single quotes: strings and keys must use double quotes:
"name", not'name'. - Unquoted keys:
{name: "Ana"}must be{"name": "Ana"}. - Comments:
//and/* */aren't allowed in standard JSON. - Special values:
undefined,NaNand functions don't exist in JSON. Usenull.
What you can use it for
- Read and debug API responses and webhook payloads.
- Clean up config files such as
package.json,tsconfig.jsonor app settings. - Minify JSON before embedding it in code or sending it over the network.
- Sort keys to make two JSON files easy to compare in a diff.
Safe for sensitive data: API responses often contain tokens and personal data. Many online formatters send your input to a server. This one never does.