JSON Formatter & Beautifier
Format and beautify JSON with 2-space, 4-space or tab indents. Pinpoints errors by line and column and keeps numbers and key order exactly as written.
Paste minified or messy JSON and get it back neatly indented, one key per line. The formatter parses the text strictly by the JSON standard (RFC 8259) and rebuilds it from what it read, so numbers, escape sequences and key order stay exactly as written — even integers too big for JavaScript. If the JSON is broken you get the line, the column and a plain-English reason instead of output.
How to use this tool
- Paste your JSON into the box (it is formatted as you type).
- Pick 2 spaces, 4 spaces or tabs for indentation.
- Optionally tick Sort keys alphabetically to make two files easier to compare.
- For tsconfig.json-style files, tick Allow comments and trailing commas.
- Copy the result, or fix the error at the line and column shown.
Formula
value = object | array | string | number | true | false | null
That is the whole JSON grammar. In the output each object member or array item sits on its own line, one indent deeper than its parent, with ": " after every key. Empty objects and arrays stay as {} and []. Strings and numbers are copied character for character.
Example
The input {"id":7,"tags":["a","b"],"ok":true} with 2-space indentation becomes 8 lines: "id": 7 and "ok": true sit two spaces in, the array items "a" and "b" four spaces in, and the closing ] and } line up under the line that opened them. With Sort keys ticked the order becomes id, ok, tags.
Frequently asked questions
Why is my JSON invalid when JavaScript accepts it?
JavaScript object literals allow things JSON forbids: single quotes, unquoted keys, trailing commas, comments, undefined and NaN. The error names the rule that was broken and where it happened.
Will formatting change my numbers?
No. Many formatters pass the text through JSON.parse, which rounds integers above 9,007,199,254,740,991 — 12345678901234567890 becomes 12345678901234567000. This tool copies each number's original text, and keeps escapes such as \u00e9 as written.
What happens to duplicate keys?
They are kept in place and flagged in a note, because most parsers silently keep only the last value.
Is my data uploaded?
No. Parsing and formatting happen in your browser, so private API responses and config files stay on your device.
Sources
Last updated: 2026-10-30