Debugging API JSON Responses: Tools and Techniques

August 1, 20269 min read

Debugging JSON from APIs is one of the most common and most frustrating tasks in software development. A minified 50 KB response, a token that keeps failing to decode, a field that shows up as null when you expected a value — these issues waste hours without the right tools. This guide covers the complete toolkit for inspecting and debugging API JSON, from browser DevTools to the command line to purpose-built web tools.

Browser DevTools: Network Tab

The browser's built-in Network tab is the first stop for debugging API responses during web development.

  1. Open DevTools (F12 or Cmd+Option+I)
  2. Click the Network tab
  3. Filter by Fetch/XHR to see only API requests
  4. Click a request to open the inspector
  5. Click the Response tab to see the raw JSON
  6. Click Preview for a formatted, collapsible tree view

The Preview tab in Chrome and Firefox DevTools renders JSON in an interactive tree — you can expand objects, copy values, and search. It is fast and always available, but limited for complex debugging tasks: no querying, no diffing, no schema validation.

curl + jq: The Terminal Workflow

curl fetches the API response; jq processes and formats the JSON. Together they are the standard command-line debugging workflow.

# Pretty-print the response
curl -s https://api.example.com/users | jq '.'

# Add authentication headers
curl -s -H "Authorization: Bearer $TOKEN" https://api.example.com/users | jq '.'

# Extract specific fields
curl -s https://api.example.com/users | jq '[.[].email]'

# Filter by condition
curl -s https://api.example.com/users | jq '[.[] | select(.role == "admin")]'

# Save response to file and inspect
curl -s https://api.example.com/data -o response.json
jq '.' response.json

# Count array items
curl -s https://api.example.com/users | jq 'length'

# Get unique values
curl -s https://api.example.com/orders | jq '[.[].status] | unique'

Postman and Insomnia

GUI HTTP clients like Postman and Insomnia provide a complete request-building and response-inspection environment:

Postman is best for comprehensive API testing workflows. For lightweight, privacy-conscious API inspection, both Postman and Insomnia send telemetry by default — check their privacy settings.

The IRJSON Debugging Workflow

For complex JSON debugging tasks, IRJSON provides a complete toolkit in a single browser tab with 100% privacy — no data leaves your device.

Step 1: Format with the JSON Formatter

Copy the raw API response from DevTools or curl, paste it into IRJSON, and press Ctrl+Enter. The minified response is instantly formatted with syntax highlighting, tree view and stats. The Stats tab shows total node count, nesting depth and byte size — immediately useful for understanding a large response.

Step 2: Extract Data with JSONPath Query

Use IRJSON's Query tool to extract specific values without manually navigating a large tree. Write a JSONPath expression like $.users[?(@.role == "admin")].email to get exactly what you need instantly.

// Useful JSONPath patterns for API debugging
$.data[*]            // all items in a data array
$..id                // all id fields at any depth
$.users[?(@.active == true)]   // filter active users
$.errors[0].message  // first error message
$..createdAt         // all timestamps

Step 3: Diff Against Expected Response

When the API returns something unexpected, use IRJSON's Diff tool to compare the actual response against what you expected. Additions, deletions and modifications are highlighted immediately. This is invaluable for catching API versioning issues and unexpected field name changes.

Step 4: Validate Against Schema

If you have a JSON Schema for the API response (from OpenAPI/Swagger), validate the actual response against it using IRJSON's Schema Validator. AJV-powered validation reports every constraint violation with exact paths — immediately identifying missing required fields, wrong types, or invalid enum values.

Step 5: Decode JWT Tokens

API responses often include JWT tokens (access tokens, refresh tokens, ID tokens). Use IRJSON's JWT Decoder to inspect the claims, check the algorithm, and verify the expiry — entirely in your browser with no server contact.

Step 6: Repair Malformed Responses

Some APIs return malformed JSON — especially older systems, AI-generated responses, or log-tailing tools that truncate output. Use IRJSON's Repair tool to automatically fix trailing commas, single quotes and other common errors before debugging the data.

Common API JSON Bugs

Bug TypeSymptomHow to Detect
Extra nestingresponse.data.data instead of response.dataTree view in IRJSON
Wrong typeid is a string instead of numberSchema validation
null vs missingField is null vs absent entirelyDiff against expected
snake_case vs camelCaseuser_id instead of userIdJSONPath query for both
Timestamp formatUnix epoch instead of ISO 8601Stats tab + tree view
PaginationOnly first page returned, not alllength() query

Frequently Asked Questions

How do I pretty-print a curl response?

Pipe through jq: curl -s https://api.example.com/data | jq '.'. The -s flag suppresses curl's progress meter. jq formats the JSON with colour highlighting in the terminal.

How do I extract a specific field from JSON in the terminal?

Use jq with a path expression: jq '.users[0].email' response.json. For all items in an array: jq '[.[].email]' response.json. You can also test these expressions in IRJSON's browser-based query tool first, then copy them to your terminal.

What is the best tool for viewing API JSON?

For browser-based inspection, IRJSON is the most complete tool: it formats, validates, queries, diffs, decodes JWTs and repairs broken JSON in one place with 100% privacy. For command-line work, jq is the standard. For GUI HTTP clients, Postman and Insomnia are both excellent for request building and testing.

Debug API responses in your browser — free

Paste any JSON response into IRJSON to format, query, diff, validate and decode JWTs. 100% private, no sign-up.

Open IRJSON Free →