Skip to content
Jun 30, 2026

How to format and validate JSON

Beautify messy JSON, minify it for production, and fix the most common "invalid JSON" errors — with a free formatter that runs in your browser and never sees your data.

JSON is everywhere a program talks to another program — APIs, config files, logs — and it's usually delivered as one unreadable line. Formatting it back into something a human can read (and spotting the one missing comma that breaks it) is a daily task for anyone who touches data. Here's how to beautify, minify, and validate JSON quickly.

Beautify vs minify

There are two directions you'll want:

  • Beautify (pretty-print): add indentation and line breaks so the structure is readable. This is what you want while reading an API response or debugging.
  • Minify: strip every unnecessary space and newline down to one compact line. This is what you ship — smaller payloads transfer faster.

They're lossless opposites: the same data, formatted for humans or for the wire.

Do it in your browser

The JSON Formatter does both and validates as you go — and because it runs entirely in your browser, your data is never uploaded, which matters when the JSON contains anything sensitive.

  1. Open the JSON Formatter.
  2. Paste your JSON.
  3. Choose Beautify to indent it or Minify to compact it.
  4. Copy the result. If the JSON is invalid, you'll see the parser error instead.

The most common "invalid JSON" errors

If a parser rejects your JSON, it's almost always one of these — strict rules that trip everyone up:

  • Trailing commas[1, 2, 3,] is invalid. JSON allows no comma after the last item.
  • Single quotes — keys and strings must use double quotes: {"name": "Jane"}, never {'name': 'Jane'}.
  • Unquoted keys{name: "Jane"} is JavaScript, not JSON. The key must be "name".
  • Comments// and /* */ are not allowed in standard JSON.
  • Missing or mismatched brackets — every { needs a } and every [ a ].
  • undefined or NaN — not valid JSON values. Use null instead.

Paste the JSON into the formatter and it points to where the parse fails, so you can jump straight to the broken character.

Why "in the browser" matters

API responses often carry tokens, personal details, or internal data. Pasting that into a random website that processes it server-side is a real leak risk. A formatter that runs locally never transmits what you paste — the work happens on your machine.

More developer tools

JSON rarely travels alone. The same free developer tools include Base64 encode/decode, a JWT decoder for inspecting tokens, hashing, UUIDs, and more — all client-side, all free.

Format your JSON now

The free JSON Formatter beautifies, minifies, and validates in one place, right in your browser with nothing uploaded. Keep it open in a tab the next time an API hands you a wall of text.