Make JSON readable, and find the broken comma.

JSON is how most apps and websites pass data around, and it is fussy. One missing quote or an extra comma and the whole file is rejected.

Paste JSON here to lay it out neatly, check it is valid, sort its keys, or squeeze it onto one line. If something is wrong, you get the line, the column and what to fix.

Runs in your browser. Nothing is uploaded.

Paste some JSON to begin.

More developer tools · All 54 tools

How to use it

  1. Paste JSON into Input, or press Load a sample. It is checked and formatted shortly after you stop typing.
  2. Choose an Indent of 2 spaces, 4 spaces or Tab, and press Format.
  3. Tick Sort keys A–Z if you want keys in a stable order, for example before comparing two files.
  4. Press Minify to remove all spacing for the smallest result.
  5. If the status shows an error, go to the line and column it names. Then Copy or Download .json.

Good to know

The rules JSON follows

JSON is defined by RFC 8259. It is stricter than JavaScript:

  • Keys and strings use double quotes, never single quotes.
  • No comma after the last item in an object or array.
  • No comments, no undefined, no NaN or Infinity.
  • Line breaks and tabs inside a string must be written as \n and \t.
  • Numbers cannot have leading zeros (007) or a leading plus sign.

Reading an error

When parsing fails, the tool walks through the text and reports where it stopped making sense. Lines and columns are counted from 1. For example:

{"a": 1,}

is reported as invalid at line 1, column 9, because a trailing comma is not allowed before }. The position points to the first character that cannot be right, so the real mistake is sometimes just before it, such as a missing comma at the end of the previous line.

Big numbers stay exact

JavaScript normally stores numbers as 64-bit floating point, which is exact only up to 253 (9,007,199,254,740,992). An ID such as 12345678901234567890 would quietly become 12345678901234567000. In current browsers that support JSON.rawJSON, this tool keeps every number exactly as written, including 1.0 and very long decimals. Older browsers fall back to normal rounding.

Other details

  • Sorting uses character code order, so capital letters come before lowercase: Apple, Zed, banana. Nested objects are sorted too; arrays keep their order.
  • If a key appears twice in one object, only the last value is kept. RFC 8259 says keys should be unique for this reason.
  • Minified size is reported in bytes of UTF-8, which is what a server will send.
  • Very large files work but can be slow, since the text is parsed and laid out in your browser’s memory.

Questions.

Is my JSON sent anywhere?

No. It is parsed by your browser on this page. That matters when the data contains customer details or API keys, which should never be pasted into tools that upload.

What are the most common mistakes?

A comma after the last item, single quotes, comments, unquoted keys and a missing comma between two items. The error message names which one it found.

Why does my file work in JavaScript but fail here?

JavaScript object syntax allows things JSON does not, such as comments, single quotes and trailing commas. JSON parsers in other languages are just as strict as this tool.

Does formatting change my data?

No. Only spacing changes, unless you tick Sort keys, which reorders keys but keeps every value. Duplicate keys are the exception: only the last copy survives.

Why would I minify JSON?

To make files and API responses smaller. Spacing is useful for people, not machines, so removing it saves bytes without changing the data.

Can it fix the errors for me?

No. It tells you where the problem is and what it looks like, so you can decide the right fix. Guessing could silently change your data.