When an API response looks fine but your app still breaks
A practical debugging walkthrough for JSON that parses cleanly yet still causes null crashes, wrong totals, or missing rows — and how to spot the mismatch fast.
You paste a response into a viewer, the validator says OK, the braces look balanced, and yet the UI still shows a blank name or a total of zero. That is the most common kind of JSON bug in day-to-day work: the document is syntactically fine, and semantically wrong for the code that consumes it. This guide is the routine I use when a teammate says "the API looks fine" and the product still misbehaves.
Start with the shape, not the values
Open the payload and name the top-level keys out loud. Status, data, error, meta — whatever the contract promised. If the envelope is different from the docs, stop there. Half of the "mystery" bugs I see are a successful HTTP 200 wrapped around an error object that the client never checks, or a list buried one level deeper than the code expects.
A table view helps when the interesting part is an array. A tree view helps when the interesting part is three objects down. Pretty-printed text alone is slow for this step because your eyes keep re-counting braces.
{
"ok": true,
"data": {
"users": [
{ "id": 12, "name": "Ada", "roles": ["admin"] },
{ "id": 13, "name": null, "roles": [] }
]
}
}Null, missing, and empty are three different stories
In the sample above, the second user has "name": null. That is not the same as omitting name, and it is not the same as "name": "". Front-end code that does user.name.toUpperCase() will crash on null. Code that checks if (!user.name) will treat all three cases as falsey and hide a bug that only shows up for one customer.
When you are reviewing a payload, ask which of the three the backend meant. Then check what your client does. Viewers that show empty cells in a table make the missing-key case obvious; raw text does not.
Types that look identical in a screenshot
The classic trap is "total": "59.90" versus "total": 59.9. Both look fine in a browser panel. One concatenates when you add; the other adds. Dates are another: "2026-11-10" versus a Unix timestamp versus an ISO string with a timezone offset. Validators will not complain about any of these because they are all legal JSON values.
If a number is involved in money or quantity math, confirm the type in a structured view before you blame the calculator. If a date sorts into the wrong month, check whether it is a string your date library actually understands.
A short routine that usually finds the bug
1) Confirm HTTP status and the envelope keys. 2) Validate that the body is JSON at all — truncated responses and HTML error pages are still common. 3) Format the document and list the top-level keys. 4) Open the array or object your UI actually reads. 5) Compare one working record next to one broken record in a table. 6) Only then dig into application logic.
Most teams reverse that order and spend an hour in the debugger. The payload usually tells on itself within a minute if you look at the right slice.
Where View My JSON fits in this routine
Paste the body into the free workspace at app.viewmyjson.com, run Validate, then switch Table for list-shaped data or Tree for deep nesting. You are not trying to replace your test suite. You are trying to see the document the same way a person would, before you write another console.log.
If you have a "before" and "after" payload from a flaky endpoint, Compare (Pro) is useful for spotting a renamed key or a value that flipped type. For everyday triage, Cards, Table, Tree, Format, and Validate are enough.