Back to blog
Fix broken JSON guide JSON · Debugging

Fix broken JSON fast: validate, beautify & find errors

Paste the error, read the line/column, fix in seconds. The 5 mistakes that break 90% of JSON — with before/after examples.

APIs don't accept "almost JSON". One trailing comma and the whole payload fails. Paste your text into the JSON formatter — it validates locally (no upload) and points to the exact line:column. Here's how to read that pointer.

1. Trailing commas — the #1 killer

// BROKEN
{ "name": "Asha", "tags": ["a", "b",], }

// FIXED
{ "name": "Asha", "tags": ["a", "b"] }

JavaScript allows trailing commas. JSON does not. Delete the last comma before } or ].

2. Single quotes and unquoted keys

// BROKEN
{ name: 'Asha', active: True, }

// FIXED
{ "name": "Asha", "active": true }

JSON needs double quotes on keys and strings, lowercase true/false/null. No comments, no functions.

3. Missing or extra brackets

// BROKEN — missing closing ]
{ "users": [{ "id": 1 }, { "id": 2 } }

// FIXED
{ "users": [{ "id": 1 }, { "id": 2 }] }

Beautify first (2-space indent), then brackets line up visually. The formatter's error column lands on the bracket that doesn't match.

4. Multiline strings and control characters

// BROKEN — raw newline inside string
{ "bio": "line one
line two" }

// FIXED
{ "bio": "line one\nline two" }

5. Numbers, dates and big IDs

  • Dates are strings: "2026-09-08", not bare dates.
  • Large IDs (> 2^53) lose precision as numbers — keep them as strings.
  • No NaN or Infinity in JSON — use null.

Safe workflow for private JSON

Never paste tokens or customer data into a server-side formatter. FastCompiler runs 100% offline after load — validate, beautify, minify, then close the tab. Your data never leaves the device. See Privacy for details.

6. Beautify for humans, minify for machines

Beautified JSON (2-space indent) is for debugging — you can see nesting at a glance. Minified JSON (no whitespace) is for production — smaller payloads, faster APIs. The formatter does both with one click. Workflow: paste minified API response, beautify to read it, fix the error, minify again before sending back. Never hand-edit minified JSON directly — one missing brace in a 10,000-character line is invisible.

// Minified (hard to debug)
{"users":[{"id":1,"tags":["a","b"]}]}

// Beautified (errors jump out)
{
  "users": [
    { "id": 1, "tags": ["a", "b"] }
  ]
}

7. Validate before you commit — a 30-second CI habit

If your repo stores .json configs, pretty-print them before committing. A quick local check — python -m json.tool config.json or pasting into the formatter — catches trailing commas your editor's syntax highlighting missed. Name the file, note the endpoint it came from, and keep a known-good sample alongside. When an API starts failing at 2am, diffing against that sample beats re-reading docs.

Related: view CSV without Excel and convert to JSON, handle that JSON with map/filter/reduce.

Validate and beautify JSON offline — no upload.

Open JSON formatter