JSON Formatter & Validator

Beautify, minify, and validate JSON instantly. Precise error messages with line and column numbers — works fully in your browser.

JSON input
Output

Need to scan documents to real PDFs?

Offline PDF Scanner turns your phone camera into a real PDF scanner — with searchable text, not just photos. Works completely offline.

What this JSON formatter does

This tool parses your JSON using the browser's strict JSON.parse and lets you format the result three ways:

  • Beautify — pretty-prints the JSON with your chosen indent (2 spaces, 4 spaces, or tab). Use when a response arrives as one giant line and you need to read it.
  • Minify — strips every whitespace character outside string literals, producing the most compact valid JSON. Saves bytes when embedding JSON in URLs, attributes, or config files.
  • Validate — just parses the input. If it succeeds you get a green "Valid JSON"; if not, you get the error line and column.

Optionally you can sort all object keys alphabetically — useful for diffing two JSON payloads or producing deterministic output.

How to use

  1. Paste JSON into the left panel or upload a .json file.
  2. Pick indent size and whether to sort keys.
  3. Click Beautify, Minify, or Validate.
  4. If there's a syntax error, the status line shows where it is. Fix it in the input and re-run.

Common JSON mistakes this will catch

  • Trailing commas — {"a": 1,} is invalid JSON (use JSON5 if you need them).
  • Single quotes — JSON strings must use "double quotes".
  • Unquoted keys — { key: 1 } is JavaScript, not JSON.
  • Comments — JSON does not support // or /* */.
  • Unescaped control characters inside strings.
  • Truncated or unterminated strings.

Privacy

Your JSON never leaves the page. Parsing and formatting happen using the browser's native engine; you can disconnect from the internet and this tool will still work.

Frequently Asked Questions