Debug API JSON Errors: Validate, Format, Diff Checklist

2026-08-04

What usually breaks API JSON

JSON.parse failures, deserialization errors, or “missing” fields are often syntax, shape, or escaping—not business logic. Work through this ComTools checklist locally.

1. Validate — is it valid JSON?
2. Format — what does the tree look like?
3. Path — where is the field?
4. Compare — what changed vs last version / docs?
5. Escape — is a string over- or under-escaped?
6. Minify — need a one-line body to replay?

1. Validate first

Open JSON Validator and paste the body.

Common error Fix
Trailing comma Remove the last ,
Single quotes / bare keys Use standard double-quoted JSON
Comments, NaN, undefined Remove or replace
Truncated body Check proxies/gateways

Guide: JSON validator.

2. Pretty-print

When valid, use JSON Formatter (2/4 spaces or Tab) and fold large objects.

Guide: JSON formatter.

3. Extract with a path

For deep trees, use JSONPath: path on line 1, JSON below—see if the value is null.

Guide: JSONPath.

4. Diff old vs new

After an API change, paste old/new into JSON Compare.

Guide: JSON compare.

5. String escaping

Symptom Likely cause Tool
Literal \"hello\" in a field Double-escaped Unescape
Whole document invalid after embedding text Missing escapes Escape

Guide: JSON escape.

6. One-line replay

For curl/Postman one-liners, use JSON Minify.

Guide: JSON minify.

Typical flow

Copy Response
  → Validate (fix syntax if red)
  → Format (inspect shape)
  → Path (business field)
  → Compare vs docs/previous
  → Escape / Minify if replaying

Also: JSON ↔ CSV for business review; JSON to SQL / JSON to C# when seeding models.

Tool map

Goal URL
Valid? /json-validator
Readable /json-formatter
Nested field /json-path
Diff /json-compare
Escapes /json-escape
One line /json-minify

All local in the browser—still avoid public machines with live tokens.

FAQ

Valid but field is null?
Renamed path or version skew—use Path + Compare.

Content-Type JSON but HTML body?
Login/error page from a gateway—copy only the JSON payload.

Array root OK?
Yes—ensure the client does not assume an object root.


中文版