Tidy some JSON
Paste JSON and pick an indent. It is checked and laid out as you type.
{
"name": "Meadow Desk",
"clients": 42,
"features": [
"invoices",
"time",
"leads"
]
}Everything stays in your browser. Nothing is sent or saved.
How to use the JSON formatter
- Paste your JSON into the input box.
- Choose 2 spaces or 4 spaces to pretty-print it, or Minify to put it on one line.
- Check the badge: Valid JSON, or Invalid with the reason in the result box.
- Copy the formatted result.
How the JSON formatter works
The tool checks your input with the browser’s own JSON parser, the same one web apps use, then lays your own text out again with the indent you chose. Parsing it is the validation: if the parser can’t, you see its message, usually with the position of the first problem.
Formatting changes only the whitespace. Numbers keep their exact digits, so a 64-bit ID like 9007199254740993 is not rounded and 1.50 stays 1.50, and keys stay in their order. A repeated key is kept too, with a warning under the badge, because most parsers keep only its last value.
- Input
- 74 characters on one line
- Badge
- Valid JSON
- At 4 spaces
- 9 lines, 125 characters
- At 2 spaces
- 9 lines, 105 characters
Minify gives back the 74 characters you started with, because the input had no spare whitespace to remove. Delete the last } and the badge turns to Invalid.