JSON Formatter & Prettifier

Format and validate JSON with clean indentation.

What This Tool Does

This formatter takes any JSON text, parses it, and re-serializes it with consistent 2-space indentation using JavaScript's native JSON.stringify(parsed, null, 2). That means every object and array gets properly nested, line-broken, and spaced — turning a dense wall of text into something you can actually read and scan.

Because the input has to be parsed before it can be reformatted, this tool doubles as a JSON validator. If your JSON has a syntax error, parsing fails and you get a clear error message instead of silently mangled output — so you know immediately that something is wrong and roughly where to look.

How to Use It

  1. Paste your JSON — minified, hand-typed, or copied from an API response — into the Input box.
  2. Click Run.
  3. If the JSON is valid, the cleanly indented, pretty-printed version appears in the Output box.
  4. If the JSON is invalid, an error message appears below the boxes describing what failed to parse.
  5. Copy the formatted result from the Output box, or click Clear to start over.

Worked Example

Input (minified):

{"id":101,"name":"Widget","tags":["a","b"],"active":true,"meta":{"price":9.99,"inStock":null}}

Output (formatted):

{
  "id": 101,
  "name": "Widget",
  "tags": [
    "a",
    "b"
  ],
  "active": true,
  "meta": {
    "price": 9.99,
    "inStock": null
  }
}

Common Use Cases

Common JSON Mistakes This Catches

Because formatting relies on JSON.parse, any text that isn't strictly valid JSON will fail with a descriptive error rather than producing garbled output. Mistakes this surfaces include:

FAQ

Does this validate JSON Schema, or just JSON syntax?

Just syntax and well-formedness. It confirms your text is valid, parseable JSON — it does not check field types, required properties, or enum values against a JSON Schema.

Can I use this to minify instead?

No, this tool only pretty-prints with 2-space indentation. For compact, whitespace-free output, use the Minify JSON tool instead.

Is my data uploaded anywhere?

No. Formatting happens entirely in your browser with JavaScript's built-in JSON parser — nothing is sent to a server or stored.

Why does it say my JSON is invalid when it looks fine?

JSON is stricter than JavaScript object literals. Trailing commas, single quotes, unquoted keys, and missing commas are the usual culprits — see the list above.

Does it support JSON5 or JSONC (comments)?

No. This tool follows the strict JSON specification, so comments and other JSON5/JSONC-only syntax will be rejected.

Related Tools & Guides