JSON and API debugging
Debug a JSON API response
Start with syntax, then inspect structure, status codes, headers, and changed fields before changing application code.
Goal: Find why an API response is malformed, unexpected, or hard to read.
Workflow steps
Step 1
Capture the raw response
Save the status code, headers, and exact JSON body before editing anything. A formatted body without the response metadata can hide the real failure.
Step 2
Validate syntax first
Paste the body into the JSON Validator. If parsing fails, fix the syntax before you inspect fields or blame application logic.
Step 3
Format and scan the shape
Use JSON Formatter to identify the top-level value, nested objects, arrays, null values, and error fields.
Step 4
Compare with a known-good response
Use JSON Diff when the response looks close to a working example. Compare paths and values instead of visually scanning two large payloads.
Real examples
Common failing body
{"error":{"code":"invalid_request","message":"Missing userId"}}Debug note
A 200 response with an error object still needs application-level handling.Common pitfalls
Debugging fields before confirming the JSON parses.
Ignoring status codes and headers.
Comparing minified responses by eye.