JSON Formatter & Validator

Paste JSON, then format or minify it. Invalid JSON shows the parser error.

Embed this tool

Paste this into your page — the widget loads noindexed and links back here.

Formatting vs minifying

Formatting (pretty-printing) adds indentation and line breaks so a human can read the structure. Minifyingstrips all of it to make the payload as small as possible for sending over a network. Both produce the same data — only the whitespace differs.

Reading parser errors

The error message names the first thing the parser could not accept. Work left to right: strict JSON needs double-quoted keys and strings, no trailing commas, and no comments. If a large document fails, minify a known-good subset to bisect where it breaks.

The rules that trip people up

  • Double quotes only. 'single' is invalid.
  • Quote every key. {name: 'Ada'} is invalid; {"name": "Ada"} is fine.
  • No trailing commas. [1, 2, 3,] is invalid.
  • No comments. Config formats that allow them (JSON5, JSONC) are different formats.
  • No NaN, Infinity, undefined, or hex numbers.

For a beginner's tour of the six JSON value types, see JSON explained for beginners.

Related tools

Frequently asked questions

Is my JSON sent anywhere?
No. Parsing uses the browser's built-in JSON engine. Your data never leaves the page, which matters when the JSON contains secrets or personal data.
Why does it say 'Unexpected token'?
That is the browser's parser telling you where it stopped. Common causes: trailing commas, single quotes instead of double, unquoted keys, or a missing bracket.
Does it support JSON5 or comments?
No. It validates strict JSON only, which is what APIs and config loaders expect. Remove comments and trailing commas first.
What indentation does it use?
Two spaces by default; you can switch to four spaces or tabs. Two spaces is the most common convention for JSON config files and API payloads.
What are the rules for valid JSON?
Double quotes only (no single quotes), keys must be quoted strings, no trailing commas, no comments, and no JavaScript values like NaN, Infinity or undefined. Numbers can't have leading zeros or a leading plus. Save as UTF-8 without a byte-order mark.
Does formatting change my data?
No. Pretty-printing and minifying only add or remove whitespace — the parsed structure is identical. Key order is preserved as written.
Is it safe to paste sensitive JSON here?
Yes. Parsing uses your browser's built-in JSON engine; nothing is sent to a server or logged. That's the main reason to use a client-side formatter for payloads containing tokens, keys or personal data.
How do I fix a large document that won't parse?
The error names the first position it choked on — look just before it, since the real mistake (a missing comma or quote) is often one character earlier. For a big file, paste a small known-good subset and grow it until it breaks to isolate the problem.

Last reviewed: September 2026. Figures and formulas are checked against their published sources; see the site's data notes.