Validate and format JSON

All tools

How to validate and format JSON

Check whether JSON parses, then choose two spaces, four spaces or compact output. Standard JSON does not accept comments.

Steps

Paste the input into the form and choose a mode if one is offered. Check the result before copying or saving it.

Use this tool: Validate and format JSON

Example

{"count":3} → { "count": 3 }
{"a":1} → { "a": 1 }

What to check

JSON keys and strings use double quotes. Comments and trailing commas are not valid standard JSON.

Common tasks and examples

Start with a small sample. Compare the structure before and after a format conversion, or check that only the intended characters changed in a text operation.

  • {"a":1} → 2 spaces
  • {"b":2} → 4 spaces
  • {"a": 1} → {"a":1}

Task reference

JSON · 2
Settings: Mode: 2 · Input: {"n":1} · What to expect: JSON · 2
JSON · 4
Settings: Mode: 4 · Input: {"n":1} · What to expect: JSON · 4
Compact
Settings: Mode: Compact · Input: { "n" : 1 } · What to expect: {"n":1}
JSON · Invalid or unsupported input format.
Settings: Input: {"n":1,} · What to expect: Invalid or unsupported input format.

More tools