How to debug and inspect API JSON responses
By Abhishek Jaiswar ยท Published
When an integration misbehaves, the response body is usually the fastest clue. A repeatable routine saves time over reading raw text.
Inspect a response in JSONWeave1. Check the status and headers before the body
A 200 status with an HTML body, a 401 with a JSON error or a missing Content-Type: application/json explains many "invalid JSON" errors before you look at a single brace. An HTML error page parsed as JSON fails at the first "<" character.
2. Make the body readable
Responses are usually minified. Format the body so nesting is visible, or open it in a tree view and collapse what you do not need. In JSONWeave, paste the body or use Open from URL when the API allows cross-origin browser requests.
3. Find the field you care about
In a large response, search for a key or value instead of scrolling. Selecting a node shows its JSON path, which you can paste into code. A query narrows the document to matching records.
$.results[?(@.status == "failed")]4. Look for the usual problems
- null where you expected an object, often from an optional field.
- A number sent as a string, such as "42" instead of 42.
- A single object where you expected an array, or the reverse, when only one result comes back.
- Timestamps in different units, seconds in one field and milliseconds in another.
- A response cut off by a size limit, which shows as an unclosed structure.
5. Compare against a known good response
If it worked yesterday, compare the failing body with a saved good one and read only the differences.
Related
Ready to try it on your own JSON?
Open the workspace, paste or drop a file, and nothing leaves your browser.
Inspect a response in JSONWeave