JSON formatter and validator

Paste JSON or open a file: if it is valid you get it neatly indented (or minified to one line); if not, you get the line, column and reason for the error. Nothing is sent to a server, so it is safe for API responses with internal data.

đź”’ Your files never leave your device

 

How to use it

  1. Paste the JSON into the box or choose a .json file.
  2. Choose the indentation (2 or 4 spaces, tab, or minified on one line) and optionally sort keys alphabetically.
  3. Press “Format and validate”. If there is an error, it is selected in the text and explained.
  4. Copy the result or download it as a .json file.

Example

A common mistake: a trailing comma

In {"a": 1, "b": 2,} the last comma is not allowed in JSON. The tool reports “Line 1, column 16: trailing comma before the closing bracket” and selects that character. Remove it and the JSON is formatted without changing any value.

How it works

The text is checked with a purpose-built validator that follows the JSON specification (RFC 8259) rather than JSON.parse, for two reasons: it can explain errors precisely (single quotes, unquoted keys, comments, trailing commas) and it does not reinterpret the content.

Formatting copies values exactly as written: an ID such as 12345678901234567890 is not rounded (JSON.parse would turn it into 12345678901234567000), 19.90 does not become 19.9 and escapes such as \u00e1 are kept.

Duplicate keys are not removed; you are told how many there are, because programs handle them differently.

Limitations

  • Extensions such as JSON5 or JSONC (comments, trailing commas, single quotes) are reported as errors so you know the input is not standard JSON.
  • Very large files (tens of MB) may take a few seconds or run out of memory on phones.
  • Maximum nesting depth: 1,000 levels.

FAQ

Is my data sent anywhere?

No. Parsing happens in your browser; you can check by going offline after the page has loaded.

What does “minify” mean?

Removing every space and line break that is not needed. The result is smaller and has identical content.

Why are comments rejected?

Standard JSON does not allow them. Some programs (certain config files, for example) use variants that do, but a strict parser will reject them.

Related tools