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.
Worked example
You paste an API response that will not parse. The tool points to line 14, column 3, where a trailing comma sits after the last item. Click Repair and the comma is removed. Then you format with 2 spaces and copy the result.
Limits to know about
- It validates standard JSON only. Comments, trailing commas and single quotes are errors unless you use Repair.
- Repair fixes common mistakes, not every problem. Always check the result.
- Very large documents show a partial tree to stay responsive.
Troubleshooting
- Repair did not fix it: Use the line and column shown to look for the remaining problem, such as a missing bracket or an unescaped quote inside a string.
- Numbers or key order changed: Sorting keys reorders them on purpose. Turn it off if you need to keep the original order.
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.