Dev Tools

Debugging Broken JSON Without Staring at the Whole File

JSON is unforgiving in a specific, frustrating way: one missing comma, one unclosed bracket, one stray quote mark, and the entire file fails to parse — with no partial result, just a hard error. Finding that one broken character by scanning a long file manually is slow and easy to get wrong.

Where broken JSON actually comes from

  • Hand-editing a config file and missing a comma between two entries, or leaving a trailing comma after the last one (which some parsers reject).
  • Copying a JSON snippet from documentation that had a typo or was truncated.
  • An API returning malformed data during debugging, where you need to quickly confirm whether the response itself is broken or your code's handling of it is the actual problem.
  • Manually merging two JSON objects and mismatching brackets in the process.

Why "just read it carefully" doesn't scale

In a short JSON snippet, scanning for a missing comma is manageable. In a file with hundreds of lines and deep nesting, visually tracking every open and close bracket becomes genuinely difficult — brackets that are supposed to match can be dozens of lines apart, and a single mismatched one cascades into an error that doesn't point clearly back to its actual cause.

Getting a specific error instead of a guess

A proper JSON validator doesn't just say "invalid" — it points to the specific line and the specific issue, which turns a manual hunt into a direct fix. That distinction matters: knowing where to look is most of the actual debugging work; the fix itself is usually trivial once you know exactly what's wrong.

  1. Paste your JSON.
  2. If it's invalid, the exact error location is shown.
  3. If it's valid, you can reformat it for readability or minify it down to a single line, depending on what you need it for.

Formatting vs. minifying

These solve opposite problems. Formatting adds indentation and line breaks — good for editing and reading. Minifying strips all unnecessary whitespace — good for production use where file size matters and no human needs to read it directly. Having both available from the same validated input means you don't need a separate tool for each.

Got broken JSON to debug? Try the JSON Validator — validation happens entirely in your browser, nothing is uploaded to a server.

Try the tool JSON Validator Validate JSON structure