Skip to content

JSON formatter and validator

Paste JSON to lay it out readably at 2 or 4 spaces, or squeeze it onto one line, and see the parser’s own message when it isn’t valid.

  • Free
  • No account
  • Runs in your browser

Tidy some JSON

Paste JSON and pick an indent. It is checked and laid out as you type.

Indent
Valid JSON
Formatted
{
  "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

  1. Paste your JSON into the input box.
  2. Choose 2 spaces or 4 spaces to pretty-print it, or Minify to put it on one line.
  3. Check the badge: Valid JSON, or Invalid with the reason in the result box.
  4. 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.

Pretty-printcheck, then re-indent with 2 or 4 spaces per level
Minifycheck, then drop every space and line break between values

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.

Worked example: the tool’s starting JSON
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.

JSON formatter FAQ

Why is my JSON invalid?

The usual causes are a comma after the last item, single quotes instead of double quotes, keys without quotes, and comments. All of those are fine in JavaScript but not in JSON. The error message points at the first one the parser hit.

Is my JSON sent anywhere?

No. It is read and formatted in your browser and never sent to our server, so API responses, config files and customer data stay on your machine.

Should I indent with 2 or 4 spaces?

Follow the project you’re working in. 2 spaces is the most common for JSON on the web and in JavaScript projects, and 4 is common in Python. Minify anything sent over the network or stored, where nobody reads it.

Can I keep design tokens in JSON?

Yes, and many design systems do: colors, spacing and type sizes as named values that a build step turns into CSS and app code. Convert each color to the format you need with the color converter first.

How do I make placeholder JSON for a mockup?

Write one record by hand, copy it a few times and fill the fields: IDs from the UUID generator, text from the lorem ipsum generator. Paste the lot here to check it parses before it goes into your prototype.

Like the tools? Meet the desk.

Sign-ups are paused for now. Save your seat and we'll email you the moment they reopen.

See pricing