JSON Formatter
Pretty-print JSON with configurable indentation and sorted keys.
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
- Paste your JSON into the editor, or use Upload to load a .json file.
- Choose an indentation style — 2 spaces, 4 spaces, or tabs.
- Optionally enable Sort keys to make two payloads easier to compare later.
- Press Format (or Ctrl/Cmd + Enter). The result appears on the right.
- 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.
{"id":42,"name":"payments-api","replicas":3,"tags":["prod","eu-west-1"]}
{
"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