JSON Formatter

Pretty-print JSON with configurable indentation and sorted keys.

JSON Runs in your browser
JSON
Formatted JSON

Nothing formatted yet

Paste JSON on the left and press Format. Invalid JSON is reported with the exact line and column.

Runs entirely in your browser. Your data isn't uploaded — this page makes no network request with anything you type, which you can verify in your browser's network tab. How this works.

What is the JSON Formatter?

A JSON formatter takes JSON that is valid but unreadable — a single-line API response, a log field, a minified config — and re-prints it with consistent indentation and line breaks so you can actually see the structure.

This one parses the document first, so formatting doubles as a validity check: if the input cannot be parsed you get the line, column and reason instead of silently mangled output. Everything happens in the page, which means you can paste production payloads without sending them anywhere.

How to use it

  1. Paste your JSON into the editor, or use Upload to load a .json file.
  2. Choose an indentation style — 2 spaces, 4 spaces, or tabs.
  3. Optionally enable Sort keys to make two payloads easier to compare later.
  4. Press Format (or Ctrl/Cmd + Enter). The result appears on the right.
  5. Use Copy to put the formatted JSON on your clipboard, or Download to save it.

Example

A minified API response, formatted with 2-space indentation.

Input
{"id":42,"name":"payments-api","replicas":3,"tags":["prod","eu-west-1"]}
Output
{
  "id": 42,
  "name": "payments-api",
  "replicas": 3,
  "tags": [
    "prod",
    "eu-west-1"
  ]
}

Features

  • 2-space, 4-space and tab indentation
  • Optional recursive key sorting for stable diffs
  • Parse errors reported with line and column
  • Large documents are formatted in a Web Worker so the page stays responsive
  • Byte count before and after formatting
  • Full keyboard operation and dark mode

Frequently asked questions

Is my JSON uploaded to a server?
No. Parsing and formatting happen in your browser using the built-in JSON parser. The page makes no network request with your input, which is why it is safe to paste real payloads.
Why does formatting reorder or change my numbers?
JSON numbers are parsed as IEEE 754 doubles, so a value with more than 15–17 significant digits (a large snowflake ID, for example) can lose precision on the round trip. If you need exact large integers, keep them as strings in the payload.
Can it handle comments or trailing commas?
Not in strict mode, because neither is valid JSON. Enable the lenient option to strip // and /* */ comments and trailing commas first — useful for JSON5-ish config files such as tsconfig.json.
What is the maximum size?
There is no hard limit, but browsers get unhappy somewhere past a few hundred megabytes. Documents above roughly 250 KB are processed in a Web Worker so typing and scrolling stay smooth.
Esc

Loading the catalog…