Live · RFC 8259 · Pretty-print · Validate

Format any JSON, instantly

Paste minified or messy JSON, get a clean indented, syntax-highlighted result. Validates as you type with precise line/column errors.

JSON Formatter Workspace
Input size
100 B
1 line
Output size
180 B
15 lines
Keys
8
original order
Status
Valid
RFC 8259
Indent
input · raw json
output · formatted
{
  "users": [
    {
      "id": 1,
      "name": "Ada",
      "role": "admin"
    },
    {
      "id": 2,
      "name": "Linus",
      "role": "engineer"
    }
  ],
  "total": 2
}
Quick Start

How to format JSON: a complete step-by-step guide

The JSON Formatter turns minified or messy JSON into clean, indented, syntax-highlighted output. Pick your indentation, optionally sort keys for stable diffs, and validate against RFC 8259. Everything happens locally — your data never leaves the browser.

  1. 01

    Paste minified or messy JSON

    Drop a JSON document into the input panel — API responses, log entries, config files, or anything in between. Validation runs as you type, and any syntax error highlights with the exact line and column.

    The tool accepts both pretty-printed and minified input; the output style is controlled separately by the indent selector. Paste with ⌘V / Ctrl+V.

    API responselog entryconfigminified
    input · raw json1 line
    {"user":"ada","roles":["admin","founder"]}
    56 B · 1 lineminified
  2. 02

    Pick your indentation and ordering

    Choose between 2 spaces (default for most language ecosystems), 4 spaces (Python-friendly), or Tab (Go and many older tools). Indentation re-applies live whenever you switch.

    Enable Sort keys for canonical, alphabetically-ordered output — useful for diffs, signatures, hashing, or stable build artifacts.

    2 spaces4 spacestabsort keys
    output · 2 spacessorted
    {
      "roles": [
        "admin",
        "founder"
      ],
      "user": "ada"
    }
    87 B · 7 linesready to diff
  3. 03

    Fix syntax errors instantly

    Trailing commas, unquoted keys, single quotes, comments, and other strict-JSON violations surface immediately with the exact position and error message. Fix the highlighted character and the formatter resumes automatically.

    This formatter is strict RFC 8259 — if your input is JSON5 or JSONC, strip the comments first.

    RFC 8259line · coltrailing commastrict
    validation errorline 2 · col 21
    SyntaxError:
      Unexpected token ',' at
      position 21 — trailing
      comma after "engineer"
    fix → retryRFC 8259 § 4
  4. 04

    Copy, download, or minify back

    Copy the formatted result to your clipboard with one click, or save it as a .json file. Need to compact it again? Hit Minify to strip whitespace and round-trip back to a single line.

    Everything runs in the browser — open DevTools → Network to confirm zero outbound requests.

    clipboard.jsonminifyprivacy-first
    export3 actions
    ✓ Copied to clipboard
    ✓ Saved: formatted.json
    ✓ Minified back to 1 line
    ✓ 100% client-side
    ready to shipsuccess
Pro tips

Production-grade JSON formatting tips

Sort keys for stable diffs

If you check JSON into git or sign payloads, enable Sort keys so the output is byte-identical regardless of original key order.

2 vs 4 vs tab

Match your existing style: package.json uses 2 spaces, Python projects often 4, Go tooling prefers tabs. Consistency > preference.

Validate before sending

Run the formatter on API request bodies before posting — it catches malformed payloads with line/col precision that beats curl's generic error.

Strict JSON only

Comments, trailing commas, and unquoted keys are JSON5 / JSONC — strip them with a separate tool first.

Big-integer precision

JavaScript loses precision past 2^53−1. Transport IDs and ledger amounts as strings.

Sensitive payloads

Nothing is uploaded. For audited compliance environments, the network tab proves zero outbound calls.

Use Cases

When to format JSON

Whenever you read, debug, diff, or hand-edit JSON. Here are the scenarios where formatting pays off the most.

Reading API responses

Curl prints minified bodies. Paste them in to see structure, find fields, and spot anomalies — without writing a one-off jq command.

10× faster to scan

Code review diffs

Sort keys and pretty-print before committing JSON fixtures. Reviewers see real changes, not whitespace and order noise. Pairs perfectly with git diff --word-diff.

cleaner PR diffs

Hand-editing config files

Editing package.json, tsconfig.json, composer.json, or AWS policies by hand is much safer when whitespace is consistent and errors surface inline.

fewer typos

Validating before sending

Catch malformed bodies before they hit production. Strict RFC 8259 parse catches trailing commas, control characters, and unterminated strings.

fewer 400 errors

Canonical signatures

Sort keys and minify before hashing — JWT, webhook signatures, JSON-LD canonicalization, and Merkle-tree leaves all rely on byte-stable input.

deterministic output

Teaching & screen sharing

Pretty-printed JSON on a 40px monitor row reads far better in a workshop, code-along, or screen-share than a one-line blob.

production-ready
FAQ

Frequently asked questions

Everything about the JSON Formatter.

No. Everything is parsed locally via JSON.parse. Zero outbound requests — open DevTools → Network to verify.
Practically your tab's memory ceiling — 50 to 100 MB before things slow down. Most documents under 10 MB format instantly.
No — this formatter is strict RFC 8259. Comments, trailing commas, and unquoted keys are rejected. Strip them with a JSON5 preprocessor first.
Yes. JSON objects are formally unordered per the spec, so any key order is valid. Sorted output is great for stable diffs and canonical hashing.
Click the Minify button in the toolbar to round-trip back to a single compact line.
Suggest a tool

Something missing?

Tell us what you need. We ship the top requests every two weeks.

Sent straight to the maintainers · no account needed
47 in queue·8 shipped this month
Request queued. Thanks!