JSON Formatter & Validator

Paste JSON to pretty-print, minify or validate it. Errors point to the exact line and column, and nothing leaves your browser.

Runs in your browserNo sign-upNothing uploaded

Output

    

How to use the JSON Formatter

  1. Paste JSON into the input box, or open a .json file.
  2. The output updates as you type. Click Format to pretty-print or Minify to strip whitespace.
  3. Pick 2 spaces, 4 spaces or tabs, and tick Sort keys for a stable key order.
  4. If the JSON is invalid, the status bar shows the line, column and the most likely cause.
  5. Copy the result or download it as a file.

What is a JSON formatter?

A JSON formatter (or JSON beautifier) re-indents compact JSON so it is readable, and a validator checks that it follows the RFC 8259 grammar. API responses, log lines and config files are usually minified to one line; formatting them makes nesting and values easy to scan.

Common JSON errors

  • Trailing commas: {"a": 1,} is valid JavaScript but invalid JSON.
  • Single quotes: keys and strings must use double quotes.
  • Unquoted keys: {name: "x"} must be {"name": "x"}.
  • Comments: // and /* */ are not part of JSON.
  • Special values: NaN, Infinity and undefined are not allowed.

Format vs. minify

Formatted JSON is for humans: code review, debugging and documentation. Minified JSON drops every optional space and newline, which shrinks payloads for storage and network transfer. Both represent exactly the same data.

Frequently asked questions

Is my JSON sent to a server?
No. Formatting and validation run in JavaScript inside your browser tab. Nothing is uploaded, so it is safe for API responses that contain tokens or personal data.
What does “Sort keys” do?
It orders object keys alphabetically at every level. Two documents with the same content but a different key order then produce identical output, which makes them easier to diff.
Are very large numbers preserved?
JavaScript numbers lose precision above 253 (about 9 quadrillion), so very large integer IDs can be rounded. Keep such IDs as strings if exact digits matter.
How large a file can I format?
Files of several megabytes format in well under a second on a modern laptop. The limit is your browser memory, not a server quota.

Related tools