JSON Formatter & Validator
Format JSON with 2-space indentation, or minify it to a single line. Runs entirely in your browser.
How it works
The input is parsed as JSON and re-serialized — formatting with 2-space indentation, or minifying by removing all insignificant whitespace. Invalid JSON is rejected with a specific error message rather than a blank result.
Examples
| Input | Formatted |
|---|---|
{"a":1,"b":[1,2]} |
{
"a": 1,
"b": [
1,
2
]
} |
FAQ
Why does my input get rejected? Common JSON mistakes: trailing commas, single quotes instead of double quotes, and unquoted keys are all valid in JavaScript object literals but not in strict JSON.
Does this handle very large JSON? Yes, within your browser's memory limits — there's also an input length guard to avoid freezing the page on an accidental multi-megabyte paste.