JSON Formatter
Validate, format and indent JSON to make it easier to read.
The JSON formatter turns compact or messy JSON into an indented, easy-to-read version, and validates that the syntax is correct. Paste the content, choose the indentation style, and watch the formatted result update automatically — or get a clear error if the JSON has a syntax problem. It's a common everyday tool for anyone working with APIs, config files, or debugging systems, since server responses often come compressed onto a single line that's nearly impossible to read by eye.
How to use
- Paste the JSON you want to format into the input box.
- Choose the indentation style: 2 spaces, 4 spaces, tab, or minified.
- Copy or download the formatted result, or fix the reported error if the JSON is invalid.
Worked example
An API response arrives compressed like this: {"user":"maria","active":true,"roles":["admin","editor"],"score":98.5}. Pasting that text and choosing 2-space indentation, the formatter lays the structure out across multiple lines, with each field and each item in the "roles" list on its own line — far easier to read and visually check than the original compact version.
Frequently asked questions
What does 'invalid JSON' mean?
It means the pasted text doesn't follow correct JSON syntax — for example, a trailing comma, single quotes instead of double quotes, or an unclosed brace. The formatter shows the error message to help you locate the problem.
What's the difference between formatting and minifying JSON?
Formatting adds spaces and line breaks to make it easier for humans to read. Minifying removes all unnecessary whitespace, making the file smaller — useful in production, where file size matters more than readability.
Is my data sent to any server?
No. All validation and formatting happens locally in your browser, using JavaScript's built-in JSON support — the pasted content never leaves your computer.
Why does my JSON with comments throw an error?
Standard JSON doesn't allow comments (lines starting with // or /* */), even though they're common in config files like VS Code's. If your content has comments, it isn't technically valid JSON — they need to be removed before formatting or validating here.
Is a trailing comma after the last item in a list or object always an error?
Yes, in standard JSON. Unlike regular JavaScript, which tolerates a trailing comma after the last element, the JSON format is stricter and rejects it — it's one of the most common mistakes when editing JSON by hand.
Are unquoted object keys, like {name: "Ana"}, valid JSON?
No. In JSON, every object key must be wrapped in double quotes, like {"name": "Ana"}. Unquoted keys are valid in plain JavaScript (as an object literal), but they're not accepted by the JSON standard.