JSON Formatter Online

Paste or type JSON on the left; the right side formats it live and parses it into a collapsible tree, pointing straight at any syntax error. Expand or collapse nodes one by one or all at once, beautify or minify, and copy node paths and values. All parsing happens locally in your browser and nothing is uploaded.
JSON text
Waiting for input
Tree view
Parsed output will appear here.
Waiting for input
Notes:
1. The input is re-parsed automatically as you type — no button to press. If parsing fails, the location of the error (line / column) is shown on the right.
2. Click the triangle in front of a node to collapse or expand it; while collapsed, the number of items it contains is shown.
3. Hovering over a node reveals a copy button on the right, which copies that node's path (such as data.items[0].id) and its value.
4. “Escape / Unescape” handles JSON that has been nested inside a string — for instance a backslash-laden JSON fragment inside a log line.

About formatting and validating JSON

When to format and when to minify

Both only touch whitespace — the data itself is identical either way. Formatting adds line breaks and indentation for human eyes: use it while debugging an API, reading logs or reviewing a config file. Minifying strips every bit of optional whitespace to cut the size: use it when writing a request body, storing a value in a database or stuffing one into an environment variable. JSON crammed onto a single line is not "broken", it simply has not been laid out for reading — paste it in and format it.

The most common reasons parsing fails

Roughly in order of frequency: a trailing comma after the last element; single quotes instead of double quotes; a double-slash comment; an unquoted key; a value of NaN or undefined, or Python-style True / None; an unescaped line break or backslash inside a string. Every one of those is legal in JavaScript or Python source, but the JSON standard does not accept them, which is why pasting a snippet out of code trips this so often. There is also an invisible variant: a BOM or non-printing whitespace at the start of the file, which can sneak in when you save from Notepad or copy from a web page.

Why read API responses as a tree

Real API responses are routinely five or six levels deep, and hunting through them by indentation alone is tiring. A tree view lets you collapse the branches you don't care about, shows at a glance how many elements an array holds and how deep a field sits, and lets you copy a node's path straight into your code. When you are chasing a production issue, the JSON in the log is often nested again as a string, carrying a pile of backslashes — unescape it first and it expands normally.

JSON is not a JavaScript object

JSON is a data interchange format with exactly six types — object, array, string, number, boolean and null. Keys must be wrapped in double quotes, and functions, date objects, comments and trailing commas are all disallowed. A JavaScript object literal is far more permissive. Note too that JSON puts no limit on numeric precision, while most parsers handle numbers as double-precision floats: integers above 2^53 (a snowflake-style ID, for instance) lose their last few digits. Fields like that are best passed as strings in the API.

FAQ

Is my JSON uploaded to a server?

No. Parsing, formatting, tree rendering and copying all happen locally in your browser through JavaScript. The page has no backend and never sends what you paste anywhere. That makes it safe for API responses containing internal fields, log fragments and config files.

What should I do when it says the JSON failed to parse?

The right-hand panel shows the browser's own error message plus the approximate line and column. Common causes: single quotes instead of double quotes, unquoted keys, a trailing comma after the last element, comments mixed into the content, or JSON that got truncated while copying. Jump to the reported position and fix it there.

Why is a very large JSON document slow to open?

The tree needs one DOM element per node, so rendering slows down once there are a great many of them. For very large documents the tool expands only the first few levels by default and leaves the rest collapsed, rendering them on expansion — which cuts the lag substantially. If your file is enormous, trim it down to the part you care about first.

What do the “Escape / Unescape” buttons do?

Some logs and database columns store a piece of JSON as a plain string, so the content is littered with backslashes like \" . “Unescape” turns such a string back into ordinary JSON and parses it; “Escape” does the reverse, converting the current JSON into a form you can embed inside a string.

Can I copy an individual node's path?

Yes. Hover over any node row and a copy icon appears on the right; clicking it copies that node's access path, for example data.items[0].name, which you can paste straight into your code or a debugging tool. Shift-click instead to copy the node's value.

Are JSON5, JSONC or JSON with comments supported?

Parsing uses the browser's built-in standard JSON.parse, so only standard JSON syntax works — no comments, single quotes, trailing commas or unquoted keys. If your content is JSON5 / JSONC, strip those extensions out by hand first.

Are very large numbers shown inaccurately?

JavaScript numbers have limited precision, so integers above 2^53 (snowflake IDs, for instance) can come back with their last few digits changed. This is a limitation shared by every tool built on JSON.parse . When you hit such a field, the fix is to return the ID as a string from the server.