Format and validate JSON
Paste your JSON to pretty-print, minify, and validate it instantly โ with the exact line and column when something's wrong. Optional key sorting included.
The most common JSON errors (and how to spot them)
Most invalid JSON trips over the same handful of details: a trailing comma after the last item in an array or object (fine in JavaScript, forbidden in JSON), single quotes instead of double quotes, unquoted keys, comments (JSON simply doesn't allow them), and values like undefined or NaN that don't exist in the standard. This tool shows you the line and column where parsing stopped โ the actual mistake is almost always right there or in the character immediately before it.
When to format and when to minify
The pretty-printed version is for you: reading an API response, debugging, or comparing two structures. The minified version is for machines: stripping whitespace and line breaks makes the file smaller, which is what you want for network payloads, config files you ship, or data stored in localStorage. The "Sort keys" option alphabetizes the properties at every level of nesting โ extremely handy when diffing two JSON documents generated at different times, since it removes differences that come purely from key order.