JSON formatter and validator — find the broken line
Paste JSON to pretty-print it, minify it, or browse it as a tree. When it will not parse, you get the exact line and column and the character that broke it — not a vague "unexpected token".
- Nothing you paste is uploaded
- Works offline
{
"invoice": "INV-2041",
"issued": "2026-08-08",
"customer": {
"name": "Kedai Kopi Aman",
"city": "Ipoh"
},
"lines": [
{
"item": "Website refresh",
"qty": 1,
"unitPrice": 2400
},
{
"item": "Hosting (12 months)",
"qty": 12,
"unitPrice": 35
}
],
"paid": false,
"notes": null
}How it works
- 1
Paste and read the verdict
Formatting happens as you type. Valid JSON is re-indented immediately; broken JSON stops and points at the first thing that is wrong, with the surrounding lines shown for context.
- 2
Choose how it should look
Two spaces, four spaces, tabs, or minified — the choice shapes the output panel and never touches what you pasted. Sorting keys alphabetically makes two versions of the same document comparable; arrays are left alone, because their order is data rather than style.
- 3
Copy or download the result
Minified output strips every space and newline, which is what you want before putting JSON in a config value or a URL. The size panel shows what that actually saves, and Copy and Download always give you exactly what the output panel is showing.
Frequently asked questions
Is my JSON uploaded anywhere?
No. The parser runs inside this page, in your browser. Nothing you paste is sent over the network, which is the point — API responses and config files routinely carry keys, tokens and customer records, and pasting those into a server-side formatter hands them to a stranger.
Why does this find errors that my editor misses?
Every browser writes its own JSON error message, and they disagree. Chrome gives a character position, Firefox gives a line and column, and Safari gives neither. This tool scans the text itself to locate the first error, so you get the same answer everywhere.
What are the most common reasons JSON fails to parse?
A trailing comma before a closing bracket, property names without double quotes, single quotes instead of double, and a line break typed inside a string. All four are named explicitly here rather than reported as an unexpected token.
Does sorting keys change my data?
It changes the order keys are written in, which JSON treats as insignificant, so any parser reads the result as the same object. Array order is never touched — in an array, order is meaning.
How large a file can it handle?
Formatting handles multi-megabyte documents fine. The tree view stops at 15,000 nodes, because drawing an element per node past that point locks up the tab. The formatted text keeps working above that limit.
Does it support JSON5, comments or trailing commas?
No, deliberately. Those are extensions that real JSON parsers reject, so accepting them here would tell you a file is fine when the service you are sending it to will refuse it.
What does the tree view give me that the formatted text does not?
Structure without scrolling. A 4,000-line API response indented to two spaces is still 4,000 lines; collapsed to a tree it is a handful of top-level keys you can open one at a time. It is the faster way to answer "does this response contain a field called customerId, and where" — and because every node stays in the document, browser find still works across the parts you have opened.
Why does my JSON have a byte order mark or an invisible character?
Because it came out of a Windows editor, a spreadsheet export, or a copy-paste from a web page. A byte order mark is three invisible bytes at the very start of a file that a strict parser reads as an unexpected character before the opening brace — which is why the error points at position 0 on a document that looks perfect. Non-breaking spaces pasted from a browser cause the same class of confusion, and both are located here by position rather than described vaguely.
Does it change numbers, dates or very large integers?
The formatted output preserves the text you pasted, so a number written as 1.50 stays 1.50 and an ID longer than JavaScript can hold as a number is not rounded on its way through. This matters more often than it sounds: a 19-digit identifier passed through a formatter that parses to a number and prints it back comes out with the last two digits wrong, silently, and nothing downstream will tell you.
Is JSON the same as a JavaScript object?
No, and the gap is where most hand-written JSON breaks. JavaScript allows unquoted keys, single quotes, trailing commas, comments and undefined; JSON allows none of them. Something that pastes happily into a browser console can still be rejected by every API you send it to, which is why this tool validates strictly rather than accepting what a JavaScript parser would.
What can I safely paste in here?
Anything, in the sense that matters: the parsing happens in this tab and nothing is transmitted. That is worth stating plainly because API responses routinely carry access tokens, customer names, email addresses and payment references, and the habit of pasting them into whichever formatter ranks first is how those end up in a stranger’s server log. Nothing is written to browser storage here either — closing the tab is the end of it.
Why does minified JSON matter?
Indentation can be a third of a document. That matters when JSON is going into an environment variable, a query string, or a request body sent thousands of times a day — and none of it changes the parsed value.