Image, File and Developer Tools

JSON Formatter

Format JSON so it is easy to read, or minify it to a single line. Invalid JSON shows the exact error message.

How to Use

Paste your JSON into the box and press Format. The formatted version and the minified version appear below. If the JSON is invalid, the error message tells you what is wrong.

Formula and Methodology

The text is parsed with the browser built-in JSON parser. On success, the pretty version is printed with 2-space indentation and the minified version is printed with no extra whitespace. On failure, the parser error message is shown.

Tips

JSON needs double quotes around property names and string values. Single quotes are not valid JSON and will cause a parse error.

Trailing commas after the last item in an object or array are not valid JSON. Remove them before formatting.

Frequently Asked Questions