Skip to main content

JSON Formatter

Pretty-print JSON. Choose spaces or tabs, indent width, and whether to repair common mistakes.

Rated 4.8 out of 5 based on 976 reviews

Input
Output

How to format JSON

  1. Paste JSON into Input.
  2. Choose Space or Tab. For spaces, set indent from 1 to 10.
  3. Leave Repair on if the paste may include trailing commas or comments.
  4. Copy or download the pretty-printed result.

JSON

Data interchange format (RFC 8259)

This tool changesWhitespace outside strings, after a successful parse
RepairOptional: comments, trailing commas, single quotes, unquoted keys

What this formatter does

It parses JSON and writes it back with indentation. Values stay equivalent after a successful parse. With Repair on, trailing commas, // and /* */ comments, single-quoted strings, and unquoted keys are normalized first.

To remove whitespace instead, use the JSON minifier. Both live under format tools.

What JSON can contain

JSON (RFC 8259) holds objects, arrays, strings, numbers, true, false, and null. It is not JavaScript. Repair can accept some JavaScript-like syntax and rewrite it into JSON. It is not a full JavaScript parser.

How errors are handled

If parsing still fails after repair (or with repair off), the output clears and the status shows the parser message. You will not get a half-formatted document that looks valid.

Formatter questions

Is my JSON uploaded?
No. Parsing happens in the page you opened.
Does formatting change the data?
Only insignificant whitespace, unless Repair rewrites non-standard syntax into JSON.
Can it format JavaScript object literals?
With Repair on, unquoted keys, single quotes, comments, and trailing commas often work. It is not a full JavaScript parser.