Back to Blog
11 min read

The API Debugging Checklist: How to Identify and Fix Silent JSON Payload Failures

Master the art of debugging API JSON payloads. Learn systematic approaches to identify parsing errors, schema mismatches, and silent failures with practical examples.

TL;DR: Silent JSON payload failures happen when APIs accept malformed data without errors. Use systematic validation, schema checking, and logging to catch issues before they reach production.

The Problem: Silent Failures

Your API returns 200 OK, but the data isn't saved. No error message, no stack trace—just silence.

Root cause: The JSON payload was malformed, but the API didn't validate it properly.

The cost: Data loss, inconsistent state, hours of debugging.

The Complete API Debugging Checklist

Phase 1: Request Validation

✅ Check 1: Is the JSON Syntactically Valid?

Test:

curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice","age":30}'

Validation: Paste the payload into our JSON Validator before sending.

Common issues:

  • Trailing commas
  • Single quotes instead of double quotes
  • Unquoted keys
  • Missing closing brackets

✅ Check 2: Is Content-Type Correct?

Problem:

curl -X POST https://api.example.com/users \
  -d '{"name":"Alice"}'

Missing: -H "Content-Type: application/json"

Result: Server treats it as form data, not JSON.

Fix:

curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice"}'

✅ Check 3: Are Field Names Correct?

Schema expects:

{"userId": "123", "userName": "Alice"}

You sent:

{"user_id": "123", "user_name": "Alice"}

Result: Fields ignored or rejected.

Fix: Match exact field names (case-sensitive).

✅ Check 4: Are Data Types Correct?

Schema expects:

{"age": 30, "active": true}

You sent:

{"age": "30", "active": "true"}

Result: Type mismatch, validation fails.

Fix: Use correct types (numbers, booleans, not strings).

✅ Check 5: Are Required Fields Present?

Schema requires:

{"name": "string", "email": "string"}

You sent:

{"name": "Alice"}

Result: Missing required field email.

Fix: Include all required fields.

Phase 2: Response Validation

✅ Check 6: Inspect HTTP Status Code

Don't trust 200 OK blindly:

curl -i -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice"}'

Look for:

  • 200 OK - Success (but verify response body)
  • 201 Created - Resource created
  • 400 Bad Request - Invalid payload
  • 422 Unprocessable Entity - Validation failed
  • 500 Internal Server Error - Server error

✅ Check 7: Parse Response Body

Problem:

{
  "status": "success",
  "errors": ["Invalid email format"]
}

Status is "success" but errors exist!

Fix: Always check for error fields, not just status codes.

✅ Check 8: Verify Data Was Saved

Don't assume success:

# Send POST request
curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice","email":"alice@example.com"}'
 
# Verify with GET request
curl https://api.example.com/users/alice@example.com

Check: Does the GET return the data you just POSTed?

Phase 3: Schema Validation

✅ Check 9: Validate Against JSON Schema

Create a schema:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "required": ["name", "email"],
  "properties": {
    "name": {"type": "string", "minLength": 1},
    "email": {"type": "string", "format": "email"}
  }
}

Validate payload:

import jsonschema
import json
 
schema = {...}  # Your schema
payload = {"name": "Alice", "email": "alice@example.com"}
 
try:
    jsonschema.validate(payload, schema)
    print("✅ Valid")
except jsonschema.ValidationError as e:
    print(f"❌ Invalid: {e.message}")

✅ Check 10: Compare with API Documentation

Documentation says:

{
  "userId": "string (UUID)",
  "profile": {
    "name": "string",
    "email": "string (email format)"
  }
}

Your payload:

{
  "userId": "123",
  "name": "Alice",
  "email": "alice@example.com"
}

Issues:

  • userId is not a UUID
  • name and email should be nested under profile

Validate Your API Payloads

Paste your JSON request/response payloads here to catch syntax errors before sending to production APIs.

Validate Payload →

Common Silent Failure Scenarios

Scenario 1: Nested Object Flattening

API expects:

{
  "user": {
    "name": "Alice",
    "email": "alice@example.com"
  }
}

You send:

{
  "name": "Alice",
  "email": "alice@example.com"
}

Result: API accepts it but ignores the data (no user object created).

Fix: Match exact nesting structure.

Scenario 2: Array vs Single Object

API expects:

{
  "items": [
    {"id": 1, "name": "Item 1"}
  ]
}

You send:

{
  "items": {"id": 1, "name": "Item 1"}
}

Result: Type mismatch, data ignored.

Fix: Use array even for single item.

Scenario 3: String Numbers

API expects:

{"quantity": 5, "price": 99.99}

You send:

{"quantity": "5", "price": "99.99"}

Result: Calculation fails, order total is 0.

Fix: Send numbers as numbers, not strings.

Scenario 4: Boolean Strings

API expects:

{"active": true}

You send:

{"active": "true"}

Result: String "true" is truthy, but not boolean true. Logic breaks.

Fix: Use boolean values (true/false), not strings.

Scenario 5: Null vs Missing

API expects:

{"name": "Alice", "middleName": null}

You send:

{"name": "Alice"}

Result: Validation fails (expects middleName field, even if null).

Fix: Include field with null value if required.

Debugging Tools & Techniques

Tool 1: cURL with Verbose Output

curl -v -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice"}'

Shows:

  • Request headers
  • Response headers
  • HTTP status code
  • Response body

Tool 2: Postman/Insomnia

Benefits:

  • Visual interface
  • Request history
  • Environment variables
  • Schema validation
  • Code generation

Tool 3: Browser DevTools

Network tab:

  1. Open DevTools (F12)
  2. Go to Network tab
  3. Make API request
  4. Inspect request/response

Look for:

  • Request payload
  • Response status
  • Response headers
  • Response body

Tool 4: JSON Diff

Compare expected vs actual:

# Expected response
echo '{"id":1,"name":"Alice","email":"alice@example.com"}' > expected.json
 
# Actual response
curl https://api.example.com/users/1 > actual.json
 
# Diff
diff expected.json actual.json

Use our JSON Diff Viewer for visual comparison.

Tool 5: Schema Validators

Online validators:

CLI validators:

npm install -g ajv-cli
 
ajv validate -s schema.json -d payload.json

Pro Tips

Tip 1: Log Everything

Server-side logging:

app.post('/users', (req, res) => {
  console.log('Received payload:', JSON.stringify(req.body, null, 2));
  
  // Process request
  
  console.log('Sending response:', JSON.stringify(response, null, 2));
  res.json(response);
});

Tip 2: Use Request IDs

Track requests across systems:

curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -H "X-Request-ID: abc-123" \
  -d '{"name":"Alice"}'

Search logs by request ID.

Tip 3: Test with Minimal Payload

Start simple:

{"name": "Alice"}

Add fields incrementally:

{"name": "Alice", "email": "alice@example.com"}

Isolate which field causes failure.

Tip 4: Validate Before Sending

Pre-flight check:

import json
 
payload = {"name": "Alice", "age": 30}
 
# Validate it's valid JSON
try:
    json.dumps(payload)
    print("✅ Valid JSON syntax")
except:
    print("❌ Invalid JSON syntax")
 
# Validate against schema
# ... schema validation code

Tip 5: Use TypeScript/Type Checking

Define types:

interface User {
  name: string;
  email: string;
  age?: number;
}
 
const payload: User = {
  name: "Alice",
  email: "alice@example.com"
};
 
fetch('/api/users', {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify(payload)
});

Catch type errors at compile time.

Real-World Debugging Example

Problem: User creation fails silently

Request:

curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Alice Smith",
    "email": "alice@example.com",
    "age": "30",
    "active": "true"
  }'

Response:

{
  "status": "success",
  "userId": null
}

Debugging steps:

  1. Check syntax: Valid JSON ✅
  2. Check Content-Type: Correct ✅
  3. Check field names: Match docs ✅
  4. Check data types:age is string, should be number
  5. Check data types:active is string, should be boolean

Fix:

{
  "name": "Alice Smith",
  "email": "alice@example.com",
  "age": 30,
  "active": true
}

Result:

{
  "status": "success",
  "userId": "550e8400-e29b-41d4-a716-446655440000"
}

Conclusion

Silent JSON payload failures are preventable with systematic validation. Use this checklist before every API call to catch issues early.

Key Takeaways:

  • Validate JSON syntax before sending
  • Check Content-Type header
  • Verify field names and types
  • Don't trust 200 OK blindly
  • Validate against schema
  • Log everything
  • Test with minimal payloads

Quick Checklist:

  1. ✅ Valid JSON syntax
  2. ✅ Correct Content-Type
  3. ✅ Matching field names
  4. ✅ Correct data types
  5. ✅ All required fields present
  6. ✅ Response status checked
  7. ✅ Response body parsed
  8. ✅ Data persistence verified
  9. ✅ Schema validation passed
  10. ✅ Matches API documentation

Debug Your API Payloads

Use our JSON Formatter to validate, format, and compare API request/response payloads.

Start Debugging →