How to format and validate JSON
Paste your JSON — the tool checks it and formats it with 2- or 4-space indentation, or minifies it to one line. If there’s an error, you get the parser’s message pointing at the problem. Data never leaves your browser, so you can safely paste API responses containing data.
Common JSON mistakes
| Mistake | Wrong | Right |
|---|---|---|
| single quotes | {'a': 1} | {"a": 1} |
| unquoted key | {a: 1} | {"a": 1} |
| trailing comma | [1, 2, 3,] | [1, 2, 3] |
| comments | {"a": 1 // note} | JSON has no comments |
| undefined, NaN | {"a": undefined} | {"a": null} |
Pretty-print or minify?
Indentation makes config files and API responses easier to read and compare. Minifying removes spaces and line breaks — the file is smaller, which matters when sending it over the network or storing it in a database.
Frequently asked questions
Can JSON have comments?
No — the JSON standard doesn’t allow them. Some tools accept JSONC or JSON5, but a standard parser reports an error.
How is JSON different from a JavaScript object?
JSON is a text format with stricter rules: keys always in double quotes, and no functions, undefined or comments.