JSON Formatter

Paste JSON, validate it, and format it into readable output.

Input

Waiting for input.

Output

How to Use This JSON Formatter

Paste any JSON into the input box and click Format JSON. Valid JSON is pretty-printed with consistent indentation in the output box; invalid JSON shows an error message describing what's wrong instead, which usually points you straight to the problem.

Why "Trailing Comma" Is the Most Common Error

A trailing comma — a comma left after the last item in an object or array — is valid in JavaScript object literals but not in JSON, and it's the single most common reason a formatter rejects an otherwise correct-looking payload:

{
  "name": "Rebel",
  "active": true,
}

That comma after true is invalid JSON, even though the exact same syntax works fine as a JavaScript object in code. JSON's grammar is deliberately stricter than JavaScript's so that it parses identically everywhere, with no ambiguity about what a trailing comma should mean.

JSON vs. JavaScript Objects: The Rules That Trip People Up

JSON looks like a JavaScript object literal, which is exactly why mistakes creep in. Four differences account for almost every "invalid JSON" surprise: object keys must be wrapped in double quotes, not left bare or wrapped in single quotes; string values must also use double quotes, never single; JSON has no comments, so a // note anywhere in a payload breaks it; and JSON has no undefined or function values — only strings, numbers, booleans, null, objects, and arrays. Copying an object straight out of JavaScript source code, quotes and comments included, is the most common way this tool ends up showing an error.

Common Uses

Useful for making a minified API response readable, checking that a config file or payload is valid JSON before using it, or cleaning up JSON you're about to paste into documentation or a bug report.

FAQ

Does this send my JSON anywhere?

No, formatting happens entirely in your browser using JavaScript's built-in JSON parser — nothing is uploaded or transmitted.

Why does it say my JSON is invalid when it looks fine?

The most common culprits are a trailing comma after the last item, single quotes instead of double quotes, or an unquoted object key — JSON is stricter than JavaScript object syntax and doesn't allow any of these.

Can this minify JSON instead of pretty-printing it?

No, this tool only formats JSON into readable, indented output.

Why can't I add comments to my JSON file?

JSON's specification never included comments, unlike JavaScript or looser variants such as JSON5/JSONC. If your source has // or /* */ notes in it, remove them before formatting, or use a JSON5-aware tool instead if your use case genuinely needs them.