JSON Formatter

Beautify, minify and validate JSON, with the exact line and column of any error.

Paste or type JSON to validate it.


Formatted JSON will appear here.

Features

  • Pretty print with 2-space, 4-space or tab indentation
  • Minify to a single line and see the bytes saved
  • Exact line and column for every syntax error
  • Optional alphabetical key sorting
  • Handles deeply nested structures and large payloads

How to use it

  1. Paste your JSON into the input box.
  2. Pick an indentation style.
  3. Press Beautify to format, or Minify to compress.
  4. Copy the result or download it as a .json file.

Common JSON errors

Four mistakes account for most parse failures. A trailing comma after the last item in an object or array is valid in JavaScript but not in JSON. Single quotes are not permitted, JSON strings require double quotes. Keys must always be quoted, even when they look like plain identifiers. And unescaped control characters, particularly literal newlines inside a string, will stop the parser cold.

When this tool reports an error it gives you the line and column, which is usually enough to spot the problem immediately. Note that the reported position is where the parser gave up, which is sometimes just after the actual mistake, a missing comma on line 8 often surfaces as an error at the start of line 9.

Frequently asked questions

Yes. There is no size cap, no daily limit, no account and no paid tier. Formatting happens in your browser, so there is no server cost to pass on to you.
No. The JSON is parsed by JavaScript running in your own tab using the browser's built-in JSON.parse. Nothing is uploaded, logged or stored. This matters when you are debugging an API response that contains real customer records, access tokens or personal data, you can paste it here without it leaving your machine. Open your developer tools and watch the Network tab while you format to confirm it.
Four mistakes cause most failures. A trailing comma after the last item in an object or array is valid JavaScript but not valid JSON. Single quotes are not permitted, JSON strings require double quotes. Keys must always be quoted, even when they look like plain identifiers. And an unescaped control character, usually a literal newline inside a string, will stop the parser. This tool reports the exact line and column where parsing gave up, which is normally enough to spot the problem, though note the reported position is sometimes just after the real mistake.
Beautify adds indentation and line breaks so the structure is readable by a human. Minify strips every optional space and newline to produce the smallest valid output, which is what you want before sending JSON over a network. Both produce semantically identical JSON, no data is changed either way.

Related tools

Further reading

📖 Why is my JSON invalid when it looks perfectly fine?

Read the full guide on the 123MiniApps blog.

Pick a theme

Ten hand-tuned palettes.