JSON Formatter

  • Free forever
  • No sign-up
  • Runs in your browser
Processed on your device

Format JSON so it is easy to read, with your choice of indent and sorted keys. Errors show the exact line and column.

About JSON Formatter

Turns a wall of minified JSON from an API, log or config file into neatly indented text you can read and check. Choose 2 spaces, 4 spaces or tabs, sort keys alphabetically at every level to compare two responses, or squeeze it back onto one line. When the JSON is broken, you get the line, the column and a pointer to the spot, plus a hint about the usual causes and a button that repairs common mistakes.

How to use JSON Formatter

  1. Paste your JSON into the box, or type it straight in.
  2. Choose an Indent of 2 spaces, 4 spaces or Tab, and tick Sort keys A-Z if you want.
  3. Click Format to tidy it, or Minify to squeeze it onto one line.
  4. Click Copy to take the result, or Download to save it as a .json file.

How your data is handled

Formatting runs in your browser with its built-in JSON parser, and nothing extra is downloaded. Tokens, customer data or config you paste aren't uploaded, logged or stored.

How SAA Tool works · Privacy Center

Limits and accuracy

  • JSON Lines files, with one object per line, aren't accepted; wrap the objects in square brackets and add commas first.
  • Try to fix it repairs common mistakes only; it can't add missing brackets or rebuild text that was cut off.
  • Very large files, tens of megabytes, can make the page slow, because everything runs in one browser tab.

Questions and answers

What happens if my JSON has an error?

You'll see the error with its line and column, a snippet pointing at the spot, and a hint for common mistakes. Click Try to fix it to repair trailing commas, single quotes, comments and similar problems.

Is my JSON uploaded?

No. Formatting happens in your browser, so API responses, tokens and config files you paste aren't sent to SAA Tool or stored anywhere.

Why did a long number change after formatting?

Browsers read JSON numbers as standard floating point, so whole numbers bigger than about 9 quadrillion (2^53) lose precision, and 1.50 is written as 1.5. Store long IDs as strings if they must stay exact.

Why did some keys move after formatting?

Keys that look like whole numbers, such as "1" or "42", are moved to the front of their object in number order. That's how browsers store object keys; all other keys keep their original order.

How does Sort keys A-Z work?

It sorts the keys of every object at every level by character code, so capital letters come before lowercase ones, and number-like keys still come first. Items in arrays keep their order, because their position usually matters.

What happens to duplicate keys?

Only the last value is kept, and the earlier ones disappear without a warning. The JSON standard says names should be unique, so find where the duplicate came from before you rely on the result.

Do I need to sign up?

No. JSON Formatter, Validator and Minifier is free with no sign-up, no login and no daily limit, and there's nothing to install. It works on a phone as well as a PC.

Can I format JSON and sort the keys?

Yes. Choose 2 spaces, 4 spaces or tabs, and tick 'Sort keys A-Z' to put the keys in order, which makes two JSON files much easier to compare.

Does it tell me where the error is?

Yes. Invalid JSON shows the line and column and what was expected, such as a missing comma or an unquoted key.

Sources and standards

Related guides

Report a problem with this tool