JSON formatter

Format and check JSON without changing your data

Output

Paste JSON to format it

Runs in your browser. Nothing is uploaded.

How it works

Paste JSON to indent it, minify it, or find what’s wrong with it. Unlike most formatters, this one never changes a value: big numbers stay exact, 1.10 stays 1.10, and duplicate keys are kept and flagged. Errors give the line and say what to fix.

Read the text into a tree, then print it again with indent. No value is changed.

Most formatters use JSON.parse, which rounds big numbers and drops duplicate keys without telling you. This tool has its own parser, which keeps the text of every value exactly as you wrote it.

JSON stands for JavaScript Object Notation. Large files are handled in the background, so the page stays responsive.

Worked example. {"amount":4500.50} becomes { "amount": 4500.50 }. The value 4500.50 keeps its trailing zero.

Advertisement

Examples

InputResult
{"a":1,"b":2}Valid JSON, 2 keys, 13 B
{"a":1,}Line 1: remove the comma after "a"
{"id":12345678901234567890}Valid JSON, 1 key, 27 B
{"a":1,"a":2}Valid JSON, 2 keys, 13 B, with a warning

What this tool doesn’t cover

  • This checks that JSON is valid. It doesn’t check it against a schema.
  • It doesn’t accept comments, because they aren’t valid JSON.

Questions

Is my JSON uploaded?

No. Everything runs in your browser, so it’s safe to paste private data.

Why does it keep duplicate keys?

Removing them would change your data. We keep both and warn you, because many programs use only the last.

Why is a trailing comma an error?

The JSON standard doesn’t allow a comma after the last item. Some editors accept it, but many programs won’t.

What is the difference between JSON and a JavaScript object?

JSON is plain text with strict rules. Keys need double quotes, and it has no comments, functions or trailing commas.

How do I fix invalid JSON?

Paste it here and read the error, which points to the line. The usual causes are single quotes, a missing comma or an extra comma at the end.

Advertisement

Was this useful?

Built by QuickToolz.

Sources: RFC 8259: The JSON Data Interchange Format (opens in a new tab)

Submit ProductLoginAccountBlogAdvertise