You have a blob of JSON and you can't read it. Maybe it's an API response, a config file, or a database export. Here's exactly how to format it, validate it, and fix any errors — step by step, with real examples.
JSON comes from many sources. Here's how to grab it from the most common ones:
| Source | How to Copy the JSON |
|---|---|
| API response (browser) | DevTools (F12) → Network tab → click request → Response tab → copy all |
| API response (Postman) | Response body panel → click Copy |
| Config file | Open in any text editor → Select All → Copy |
| Database export | Export as JSON from your DB tool → open the file → copy contents |
| Console output | Select the JSON object in console → right-click → Copy Object |
| Log file | Find the JSON line → copy the JSON portion only |
You get properly indented, syntax-highlighted JSON. Each nesting level is indented, arrays and objects are clearly structured, and you can scan the data at a glance. Copy the formatted version for documentation, code review, or debugging.
The tool shows exactly where the error is — line number, character position, and error type. Here are the most common errors and their fixes:
| Error | What You Wrote | What JSON Expects | How to Fix |
|---|---|---|---|
| Trailing comma | [1, 2, 3,] | [1, 2, 3] | Remove the comma after the last item |
| Single quotes | {'name': 'Alice'} | {"name": "Alice"} | Replace all single quotes with double quotes |
| Unquoted key | {name: "Alice"} | {"name": "Alice"} | Wrap every key in double quotes |
| Comment in JSON | {"a": 1} // note | {"a": 1} | Remove all comments — JSON has no comment syntax |
| Missing bracket | {"users": [{"id": 1} | {"users": [{"id": 1}]} | Count opening/closing brackets and braces — they must match |
| Undefined value | {"a": undefined} | {"a": null} | Replace undefined with null (or remove the key) |
Once your JSON is valid, you have two output options:
Use when: reading, debugging, code review, documentation, sharing with team members. This adds indentation and line breaks so humans can scan the structure quickly.
Use when: production config files, API payloads, storing in databases, reducing file size. Minification strips all whitespace. A 50KB formatted JSON file might compress to 15-20KB minified.
| Task | Tool | Shortcut / Steps |
|---|---|---|
| Format/beautify | JSON Formatter | Paste → auto-formats |
| Validate | JSON Formatter | Paste → errors highlighted instantly |
| Minify | JSON Formatter | Paste → click Minify |
| Compare two JSON files | Diff Checker | Paste both → see differences |
| JSON → spreadsheet | JSON to CSV | Paste array → download CSV |
| Spreadsheet → JSON | CSV to JSON | Paste CSV → get JSON array |
| Format code (JS/HTML/CSS) | Code Formatter | Paste → select language → format |
| Understand code | Code Explainer | Paste function → get explanation |
Format, validate, and pretty print JSON — step by step, free, private.
Open JSON Formatter