JSON Formatter
Format, validate and minify JSON — with the exact line and column of any error.
Runs in your browser — nothing you type is sent anywhere
Your JSON
Result
The formatted result appears here as you type. Nothing is sent anywhere — the parsing happens in this page.
About the JSON Formatter
Most JSON problems are not really formatting problems — they are a single misplaced character somewhere in a few hundred lines. The browser's own error for that is famously unhelpful: "Unexpected token } in JSON at position 412" gives you a character offset in a file you are reading as lines. This formatter turns every parse failure into a line number, a column, the offending line of text, and a caret pointing at the character that broke it.
That matters more than it sounds, because JavaScript engines disagree about what they tell you. Chrome alone throws two different message shapes depending on the error, one carrying a position and one carrying only a quoted excerpt, and Firefox and Safari word theirs differently again. All of them are normalised here so you get the same answer whichever browser you are in.
Pretty-printing supports two, four or tab indentation, and minifying strips every byte of insignificant whitespace — useful when you are pasting a payload into a config field with a size limit. Sorting keys alphabetically makes two versions of the same document comparable in a diff, and it deliberately leaves arrays in their original order, because the order of an array is data rather than presentation.
A byte order mark at the start of a file is stripped before parsing. It is invisible, it is common in files exported from Windows tools, and it otherwise causes a failure at position zero with a message that makes no sense.
Nothing you paste leaves the page. That is the point for this tool in particular: the JSON developers most often need to inspect is a real API response with real tokens, real customer records or real keys in it, and pasting that into a website that round-trips it through a server is a genuine leak.
How to use the JSON Formatter
Paste your JSON
Drop it into the left panel. It is parsed on every keystroke, so you do not need to press anything to find out whether it is valid.
Read the result or the error
Valid JSON appears formatted on the right. Invalid JSON shows the message, the line and column, and a caret under the exact character that failed.
Choose how it should look
Switch between pretty and minified, pick two spaces, four spaces or tabs, and optionally sort every object's keys alphabetically.
Copy or download it
Copy puts the result on your clipboard; Download saves it as a .json file. Both act on exactly what you see in the result panel.
Frequently asked questions
Why does my JSON say it is invalid when it looks fine?
Is my JSON uploaded to a server?
What does minifying actually save?
Does sorting keys change my data?
Can it handle very large files?
Are JSON5, JSONC or comments supported?
You may also need
JSON Validator
Find out exactly where your JSON breaks — and what is most likely causing it.
JSON Viewer
Fold a big JSON document into something you can actually read — and copy paths out of it.
SQL Formatter
Turn a one-line query into something you can read — and review before running.
JSON to CSV
Turn an array of JSON objects into a spreadsheet-ready CSV, nested fields included.