How to use the JSON Formatter & Validator
- Paste your JSON
- Click Format, Minify or Validate
- Copy or download the result
Format, validate and minify JSON
Paste JSON to pretty-print it with your choice of indentation, check that it is valid, or minify it into one compact line for APIs and config files. When the JSON is invalid, the error message points to the line and position of the problem.
Most common JSON errors
- Trailing commas โ
{"a": 1,}is not allowed in JSON. - Single quotes โ strings and keys must use double quotes:
"name", not'name'. - Unquoted keys โ
{name: "x"}is JavaScript, not JSON. - Comments โ JSON has no comments; remove
//and/* */.
Your data stays in your browser, so it is safe to format API responses containing tokens or personal data.
Beautify, minify or explore as a tree
Format / Beautify re-indents the JSON with 2 spaces, 4 spaces or tabs. Minify removes every unnecessary space and line break, which makes API payloads and config values smaller. Tree view shows the data as collapsible objects and arrays โ the quickest way to understand a large API response you didn't write.
Sort keys for clean comparisons
Tick Sort keys to put every object's keys in alphabetical order, at every level. Two JSON files with the same data but keys in a different order then format identically, so you can paste both into Text Compare and see only the real differences.
Reading the error message
When the JSON is invalid you get the parser's reason plus the exact line and column, for example โUnexpected token } (line 14, column 3)โ. The real mistake is usually just before that point โ most often a missing comma at the end of the previous line, or an extra one before a closing bracket.
Copy or download
Copy the result to the clipboard, or download it as a .json file. The size shown after a successful check is the size of the JSON as entered, which helps when an API or database field has a size limit.