JSON Formatter & Beautifier

Paste JSON to pretty-print it, minify it or sort its keys. If it is broken, you get the exact line and column — and one click to repair it.

Result
Formatted JSON appears here.

Valid JSON ·

What makes JSON valid

JSON is a strict subset of JavaScript object syntax, defined in RFC 8259. Keys must be strings in double quotes. Values can be a string, a number, true, false, null, an object or an array — nothing else. That rules out undefined, NaN, dates, functions and comments.

  • Trailing commas — [1, 2, 3,] is fine in JavaScript and invalid in JSON.
  • Single quotes — {'a': 1} must be {"a": 1}.
  • Python output — True, False and None must be lowercase true, false, null.
  • Big integers — numbers above 253 lose precision when parsed in JavaScript. Send IDs as strings.

Need only a yes/no answer with the error location? Use the JSON validator. Turning an API response into a spreadsheet? Try JSON to CSV.

Questions people ask

Is it safe to paste JSON with API keys or customer data here?

Formatting, minifying and validating all run in your browser with the built-in JSON.parse, so the data never leaves your device. Only the “Fix it with AI” button sends text to a server, and only when you press it.

What is the difference between beautify and minify?

Beautify adds line breaks and indentation so people can read the structure. Minify removes every unnecessary space and newline so the file is as small as possible for sending over a network. The data is identical either way.

Why does my JSON fail with “Unexpected token”?

The most common causes are a trailing comma after the last item, single quotes instead of double quotes, keys without quotes, and comments. JSON (RFC 8259) allows none of these, even though JavaScript does.

Does sorting keys change my data?

No. JSON objects are unordered by definition, so sorting keys only changes how the file reads. Array order is always kept, because array order is meaningful.

How large a file can I format?

Several megabytes works comfortably in a modern browser. Very large files (50 MB and up) may make the tab slow because the whole document is parsed in memory.

Related tools