JSON Formatter, Validator & Viewer
transform
output
tree
About the JSON formatter
This tool parses JSON with the browser's native JSON.parse, so validation errors match exactly what your own code would throw — the error is flagged inline as you type. Formatting, minifying, and sorting all happen in memory in this tab — nothing is uploaded, logged, or cached on a server, which matters if you're pasting real API responses or config that contains customer data.
How to use it
Paste your JSON into the input panel — parsing starts immediately and the status bar tells you whether the document is valid before you touch anything else. Then use the transform buttons in the centre strip: Format pretty-prints with consistent indentation,Minify strips every unnecessary byte of whitespace for the smallest payload, and Sort keys alphabetizes object keys at every depth, which makes two documents easy to eyeball even when their key order differs. Escape turns your document into a quoted string literal (useful when embedding JSON inside another JSON value or a shell argument), and Unescape reverses it. Copy grabs the current output; Download saves it as a .json file.
Exploring large documents
Use the tree view to collapse and explore deeply nested objects and arrays — hover any node to see its full path in the breadcrumb bar, click the breadcrumb to copy that path, or use search to jump straight to a key or value. The JSONPath box finds nodes structurally, so queries like$..title or$.items[?(@.price > 10)] highlight every matching node and let you step between them. Switch to raw view to copy a plain formatted string. Expand all and Collapse all give you one-click control over the whole tree when you're orienting yourself in a document with hundreds of nodes.
Common JSON errors — and what they actually mean
Because validation uses the browser's own parser, the messages here are identical to the ones your application throws. The frequent offenders:
- Unexpected token < in JSON at position 0
- The response isn't JSON at all — position 0 holding
<almost always means you received an HTML error page. Check the request URL and HTTP status before debugging the payload. - Unexpected end of JSON input
- The document stops mid-value: a truncated download, a proxy that cut the connection, or a copy-paste that missed the tail. Re-fetch the payload in full.
- Unexpected token } — trailing comma
- JSON forbids a comma before a closing brace or bracket. Delete the final comma after the last property.
- Single quotes or unquoted keys
- JavaScript object literals allow both; JSON allows neither. Every key needs double quotes and every string value needs double quotes — convert once with the formatter and re-check.
- NaN, Infinity, or comments
- None of these exist in JSON. Replace non-finite numbers with
nullor strings, and strip//comments before validating.
Gotchas that survive validation
Some JSON problems are legal but still bite. Duplicate keys parse without error, and most parsers silently keep the last value — if a config behaves mysteriously, format it and scan for repeated keys. Very large integers lose precision because JavaScript numbers are 64-bit floats: IDs like 9007199254740993 come back as ...992, so treat big IDs as strings at the source. And \uescapes are always valid — a document full of them is fine for machines but unreadable; formatting won't decode them, but pasting decoded text back in will.
When to format vs minify
Formatted output is for humans: code review, debugging, documentation. Minified output is for machines: request bodies, cache entries, message queues. A useful habit is to minify before sending and format after receiving — the bytes you save on a chatty API compound quickly, and the readability you gain on inspection does too. Sorting keys before adiff also removes false positives caused purely by key reordering.
Related: compare two versions of a document with the JSON difftool, or convert your JSON to CSV,YAML,TypeScript, orJSON Schema. For the XML side of your configuration, see the XML formatter.
FAQ
Is my JSON sent anywhere?
No. The live counter above confirms zero network requests fire while you use this tool.
What's the file size limit?
There's no hard limit — it's bounded only by your browser's available memory.