JSON Formatter & Beautifier
Format, beautify and validate JSON instantly. Get the exact line and column of any error, duplicate-key warnings, and a full structure breakdown — all in your browser.
Tip: click Repair to auto-fix trailing commas, single quotes, unquoted keys and comments.
About this JSON
Session History
Formatted JSON from this session will appear here.
History is kept only in your browser memory for this session and is cleared when you refresh or close the page. Nothing is stored or uploaded.
All formatting and validation happen locally in your browser — your JSON is never sent to a server. Numbers larger than 2^53 may lose precision, which is a limitation of JSON in JavaScript, not of this tool.
What It Does
JSON is the everyday format for API responses, config files and data interchange, but it usually arrives minified onto a single unreadable line, and when it is malformed the built-in browser error is famously unhelpful. This tool fixes both problems. Paste any JSON and it instantly re-indents it into a clean, readable layout (2 spaces, 4 spaces, tabs, or minified), optionally sorting every object's keys. At the same time it validates the document with a strict parser that pinpoints the exact line and column of the first error and explains it in plain English. And because it parses the structure itself, it can tell you things JSON.parse never will: the byte size, the nesting depth, how many objects, arrays and keys there are, and — crucially — whether any duplicate keys are silently throwing away data. Everything runs locally in your browser, so nothing is uploaded.
When to Use It
- An API returned a minified blob and you need to read it — paste it here to pretty-print and inspect the structure.
- Your JSON is being rejected somewhere and you need to know exactly which line and column is wrong, and why.
- You suspect a config or payload has duplicate keys quietly dropping values, and you want them flagged with their path.
- You need a canonical form for diffing two JSON documents — sort the keys and minify both so the comparison is clean.
Worked Examples
{"name":"Ada","skills":["json","js"],"active":true,"projects":42}
A normal, valid object delivered on one line. It is pretty-printed and the insight panel reports the key count, depth and value types.
{"id":1,"name":"first","id":2}
Contains a duplicate key. JSON.parse would silently keep id=2 and discard id=1. The tool flags the duplicate, its path and line so you do not lose data unknowingly.
{"a":1,"b":[1,2,3],}
Has a trailing comma before the closing brace — invalid JSON. The tool reports the exact line and column and explains that trailing commas are not allowed.
{"user":{"profile":{"address":{"geo":{"lat":12.9,"lng":77.5}}}}}
Deeply nested. The structure breakdown highlights the maximum nesting depth, which is easy to miss when reading minified JSON.
Features
How to Use
1. Paste or type your JSON into the input area. 2. Choose an indentation style (2/4 spaces, tab) or pick Minify. 3. Optionally enable Sort keys for canonical output. 4. Read the formatted result, and check the insight panel for size, structure and duplicate-key warnings. 5. If the JSON is invalid, the exact line, column and reason are shown. 6. Click Copy to copy the result or Clear to reset.
Common Mistakes
- Using single quotes. JSON requires double quotes for every key and string value — single quotes are a JavaScript habit that JSON rejects.
- Leaving a trailing comma. A comma before a closing } or ] is valid in JavaScript and many languages, but not in JSON.
- Assuming duplicate keys are harmless. Parsers keep only the last value and drop the rest with no warning — always check for duplicates.
- Forgetting JSON has no comments. // and /* */ comments are not part of JSON and will cause a parse error.
- Treating large numbers as safe. Integers beyond 2^53 lose precision when parsed into JavaScript numbers — keep very large IDs as strings.