JSON formatter and validator

Paste JSON and get it neatly indented, or all on one line. If the JSON is invalid you see the line and character where it goes wrong, and what the problem is.

Indent

How it works

  1. Paste your code

    Paste the code in the left box or open a file. No code to hand? Click Example.

  2. Instant result

    The result appears as you type. If there is an error, you see the line and character.

  3. Copy or download

    Copy the result with one click or save it as a file for your editor or project.

Validating JSON

Common mistakes are a comma after the last item, single quotes instead of double quotes, keys without quotes, and comments (JSON doesn't allow them). The formatter points to the exact spot, for example line 4, character 12: extra comma before }.

Options

  • Indent with 2 or 4 spaces or a tab, or all on one line to minify.
  • Sort keys alphabetically makes two JSON documents easy to compare.

Very large numbers

JavaScript stores numbers with about 15 significant digits. IDs that are longer than that (as in some APIs) can be rounded. The tool warns you when your JSON contains such numbers. Converting JSON? Try JSON to CSV or JSON to YAML.

Frequently asked questions

Is the JSON formatter free?

Yes. The JSON formatter is completely free, with no account, sign-up or usage limit.

Is my code stored?

No. Your code is processed in your browser and is not sent to a server or stored.

Does it work on my phone?

Yes. The tool works in any modern browser on a phone, tablet or computer.