How to format and validate JSON
- Paste your JSON into the input box — a full API response, a config file, or a single object.
- Choose an indent width (2 spaces, 4 spaces, or tabs) to match your project's style.
- Click Format & validate. Valid JSON is reprinted with consistent indentation; invalid JSON shows exactly where parsing failed.
- Need a compact version instead? Click Minify to strip all whitespace.
- Click Copy result to grab the output.
Formatting and validation both run through the browser's native JSON.parse and JSON.stringify — the same engine your code will use to consume the data. Nothing is uploaded.
Why JSON errors are hard to find by eye
A single missing comma, an extra trailing comma, or an unescaped quote inside a string can make an entire JSON document unparseable — and the failure is often several lines away from where the mistake actually is, because the parser doesn't know it's broken until it hits something that can't possibly follow. Scanning a 200-line minified API response by eye for a missing brace is slow and error-prone.
This tool surfaces the browser's native parse error along with a line and column number, so instead of scanning the whole document you can jump straight to the problem. The most common culprits, in order of frequency:
- Trailing commas —
{"a": 1, "b": 2,}— valid in JavaScript object literals, invalid in strict JSON. - Single quotes — JSON strings must use double quotes.
{'key': 'value'}is not valid JSON, even though it's valid JavaScript. - Unquoted keys —
{key: "value"}is JavaScript object shorthand, not JSON. Keys must be quoted strings. - Unescaped control characters or quotes inside strings — a literal
"inside a string value needs to be escaped as\". - Comments — JSON has no comment syntax.
// like thisor/* like this */will fail to parse, even though some JSON-adjacent formats (JSON5, JSONC) allow them.
Format vs. minify: when to use each
Formatted (indented) JSON is for humans — reading API responses during debugging, reviewing config files in a pull request, or writing documentation examples. The extra whitespace costs nothing when a human is going to read it once and move on.
Minified JSON is for machines and networks. Every space and newline is a byte that has to be transmitted and parsed; stripping them shrinks payload size, which matters at scale — a public API serving millions of requests a day saves real bandwidth by minifying responses. It also shows up as the default output of most JSON.stringify() calls with no arguments, and as what you'll see in browser network tabs and log files. Minify here to see exactly what a compact payload will look like, or to shrink a formatted file back down before pasting it somewhere space-constrained (an environment variable, a URL parameter, a database column with a size limit).
JSON vs. JSON5 vs. JSONC
Strict JSON (RFC 8259) — what this tool validates — is deliberately minimal: it has no comments, no trailing commas, no unquoted keys, and no single-quoted strings. That minimalism is a feature: it's what makes JSON parseable identically in every language with almost no ambiguity, which is why it won as the universal data-interchange format.
Some tools accept relaxed variants — JSON5 adds comments, trailing commas, and unquoted keys for hand-written config files; JSONC (JSON with Comments) is what VS Code uses for its own settings files. If your input is one of these relaxed formats rather than strict JSON, this tool will correctly flag it as invalid — because it isn't valid JSON, even if a specific tool happens to accept it.
Privacy: what happens to your data
JSON often contains sensitive data — API keys, auth tokens, customer records, internal config. This tool never sends what you paste anywhere; parsing and formatting happen with browser-native functions, locally, in the tab. Open DevTools → Network while using it and you'll see no requests fire. Nothing is logged, cached remotely, or stored beyond your current browser session.