pegbenchAll tools
Developer

JSON Formatter

Format, validate, minify and sort JSON online. Shows the exact position of syntax errors. Free JSON beautifier that runs in your browser.

About the JSON Formatter

Make messy JSON readable, check that it is valid and find the exact spot where it breaks. Beautify with your preferred indentation, sort keys alphabetically, or minify it for production.

How to use it

  1. Paste your JSON.
  2. Click Format, Minify or Sort keys.
  3. Fix any reported error, then copy or download the result.

Format, minify and sort

Format re-indents JSON with 2 spaces, 4 spaces or tabs so nested objects are easy to read. Minify removes every unnecessary space and line break for the smallest payload. Sort keys orders object keys alphabetically at every level, which makes two JSON documents much easier to compare with the Text Compare tool.

Finding errors

When the JSON is invalid you get the parser's message and, where possible, the line and column of the problem. The usual culprits are a trailing comma after the last item, single quotes instead of double quotes, unquoted keys, comments, and values like undefined or NaN, none of which standard JSON allows.

Safe for sensitive data

API responses and configuration files often contain tokens, customer data or internal URLs. Because everything happens in your browser, nothing you paste is sent to a server or stored.

Frequently asked questions

Why is my JSON invalid?

Common causes are trailing commas, single quotes instead of double quotes, unquoted keys and comments, none of which are allowed in standard JSON.

Is my data sent to a server?

No. Parsing and formatting happen in your browser, so it is safe for API responses and config files.

What does minify do?

It removes all unnecessary whitespace to make the JSON as small as possible.

Related tools