How to Format and Validate JSON (and Fix Common Errors)
JSON FormatterBeautify, validate, minify and repair JSON. Free, no sign-up.JSON from an API response or a log line is often one long unreadable line, and a single stray comma makes the whole document invalid.
Format and validate in one step
- Open the JSON Formatter and paste your JSON (or open a
.jsonfile). - Choose 2 spaces, 4 spaces or tabs, or minify it.
- If the JSON is invalid, the formatter shows the line and column of the first error. Fix it and the output updates.
Your data never leaves the browser, so you can paste production payloads, configuration files and tokens without sending them to a server.
The errors you will see most
| Error | Example | Fix |
|---|---|---|
| Trailing comma | {"a": 1,} |
Remove the last comma. |
| Single quotes | {'a': 1} |
JSON needs double quotes: {"a": 1}. |
| Unquoted keys | {a: 1} |
Quote the key: {"a": 1}. |
| Comments | // note |
JSON has no comments; remove them. |
| Wrong value | undefined, NaN |
Use null or a number. |
The Repair button fixes trailing commas, comments and quote problems automatically, which is handy for JavaScript-style objects pasted from code.
Explore large documents
Switch to the collapsible tree view to fold big arrays and objects, and use sort keys to compare two documents more easily.
Related conversions
- Configuration in YAML? Convert it with YAML to JSON.
- Spreadsheet data? Turn a CSV into JSON with CSV to JSON.