JSON formatter and validator

Paste JSON to check it and tidy it up. If something is wrong, you get the line, the column and a plain explanation of what to fix.

FreeNo sign-upRuns on your device

Loading the tool…

How to use it

  1. Paste your JSON into the box.
  2. If it's invalid, read the message and the marked line, fix it, and the check runs again.
  3. Choose 2 spaces, 4 spaces, tabs or minify, and tick Sort keys if you want them in order.
  4. Copy the result, download it as a .json file, or press Format in place.

How the checker finds errors

Browsers describe JSON errors in different ways, and some give no position at all. This tool runs its own strict check that follows the JSON standard (RFC 8259) and stops at the first problem. It tells you the line and column and explains the problem in plain words, such as a missing comma, a trailing comma before a closing bracket, single quotes instead of double quotes, or a string that isn't closed.

The line with the problem is shown with a mark under the exact spot. Fix it and the check runs again as you type.

Format, minify and sort

Formatting adds line breaks and indentation so the structure is easy to read. Minify removes every space that isn't needed, which makes the file smaller for sending over a network. Sort keys puts the keys of every object in A to Z order, at every level. That makes two versions of the same data much easier to compare, for example with the text diff checker.

Numbers are kept as JavaScript reads them. Very large whole numbers, above about 9 quadrillion, lose precision in any browser tool, so check IDs of that size by hand.

Common JSON mistakes

Keys and text values must use double quotes. A comma after the last item in a list or object is not allowed. Comments are not allowed. Only true, false and null can appear without quotes. If you copied JSON from JavaScript code, these are the usual problems.

Privacy

Your JSON never leaves your browser, so it's safe to paste API responses and config files. Still, avoid pasting live passwords or keys into any website you don't control.

Questions

Is it safe to paste private JSON here?

The check and formatting run in your browser and nothing is uploaded. As a habit, remove live passwords and API keys before pasting anything into any website.

Why does it say "trailing comma"?

There is a comma after the last item in a list or object, like [1, 2, ]. JavaScript allows that, but JSON does not. Delete the last comma.

Can JSON have comments?

No. Standard JSON has no comments. Some tools accept JSON with comments (often called JSONC), but most parsers will reject it.

What does minify do?

It removes spaces and line breaks that aren't needed. The data stays exactly the same, but the file is smaller.

Does sorting keys change my data?

No. In JSON the order of keys in an object has no meaning, so sorting only changes how it looks. Lists keep their order.