JSON in
Tree
Paste JSON to explore it as a collapsible tree.
About JSON Formatter
Minified JSON off an API is one enormous line. Formatting it makes it legible, but past a few hundred lines legible is not the same as navigable — you end up scrolling through arrays you do not care about to find the one field you do.
This tool does three things with the same input: formats it with real indentation, validates it and points at the exact character where parsing failed, and renders it as a collapsible tree you can fold down to the shape you need.
- Format with configurable indentation
- Collapsible tree view with type colouring
- Validation with the exact error position
- Minify to a single line
- Alphabetical key sorting for diffs
How to use JSON Formatter
Paste your JSON
Formatted or minified, from an API response, a config file, anywhere.
Choose a view
Format for indented text, Tree for a collapsible structure, Minify to strip it back down.
Fix any errors
Invalid input reports the position and what the parser expected there, rather than just saying it failed.
Sort keys if you are comparing
Alphabetising both sides of a diff removes ordering noise and leaves the real differences.
Copy the result
One click, in whichever view you are in.
When to use the tree view
Formatted text is the right view when you are reading a small object end to end. The tree wins the moment the payload is bigger than a screen: nodes below the second level start collapsed, so you see the top-level shape first and open only the branch you care about.
Values are coloured by type — strings, numbers, booleans and null each get their own colour — which makes it possible to spot a number that arrived as a string, one of the more common causes of a bug that only shows up in production.
Common JSON errors and what they mean
A trailing comma after the last element of an array or object is the most frequent one. JavaScript allows it, JSON does not, and a config file written by hand almost always picks it up eventually.
Single quotes are the second. JSON requires double quotes on both keys and string values; a pasted JavaScript object literal will fail on the first key. Unescaped newlines inside a string and unquoted keys round out most of the rest.
The error message here reports the character position, so for a long file you can go straight to the problem rather than bisecting it by hand.
Formatting versus minifying
Formatting adds whitespace for humans. Minifying removes all of it for machines. The parsed value is identical either way — whitespace outside strings carries no meaning in JSON, so neither operation can change what your data says.
Minify before sending JSON over the wire or embedding it in a bundle. Format when a person has to read it or when it goes into version control, where a formatted file produces line-by-line diffs instead of one unreadable changed line.
Is it safe to paste sensitive JSON here?
Parsing, formatting and validation all happen in your browser using the built-in JSON parser. The page makes no network request with your input — there is no server to send it to.
That said, treat any web tool with production secrets the way you would treat a chat window: if the payload contains live credentials, rotate them regardless of what any site promises.
Frequently asked questions
Why does it show a line number when the browser does not?
JSON.parse reports a character offset, which is useless in a large file. We convert that offset into a line, a column and the offending line itself.
What does sorting keys do?
It orders object keys alphabetically at every level, making two payloads that describe the same thing directly comparable. Array order is left alone, because that is data rather than formatting.
Is my JSON uploaded?
No. Parsing and formatting happen in your browser, which matters when the payload contains real customer data.
Related tools
Last updated 18 Aug 2026 · Free to use · Runs entirely in your browser