← Back to Blog

How to Debug API Responses: JSON Viewer Tips

Master API debugging with professional JSON viewer techniques. Learn to inspect, filter, and troubleshoot API responses efficiently using modern tools and proven strategies.

Big JSON Team14 min readprogramming
B

Big JSON Team

Technical Writer

Expert in JSON data manipulation, API development, and web technologies. Passionate about creating tools that make developers' lives easier.

14 min read

# How to Debug API Responses: JSON Viewer Tips

Debugging API responses is a daily task for web developers, but most people use their JSON viewer incorrectly. This guide reveals professional techniques to inspect, analyze, and troubleshoot API responses 10x faster using modern JSON viewers.

Whether you're working with REST APIs, GraphQL, or WebSockets, these tips will transform your debugging workflow.

---

Why Proper JSON Viewing Matters

The Pain Points

Without effective JSON viewing, developers waste hours:

  • 😫 Scrolling through thousands of lines of minified JSON
  • 🔍 Manually searching for specific fields in nested objects
  • 🐛 Missing critical error messages buried in responses
  • ⏰ Copy-pasting data between tools to understand structure
  • 💥 Crashing browsers with massive API responses

The Solution

Professional JSON viewers provide:

Instant formatting - Transform minified JSON into readable structure

Interactive navigation - Collapse/expand nested objects

Path finding - Locate exact data locations

Type highlighting - Distinguish strings, numbers, booleans at a glance

Search & filter - Find needles in haystacks instantly

---

Choosing Your JSON Viewer

Browser Developer Tools

Chrome DevTools:
  • Built-in JSON viewer for API responses
  • Network tab shows formatted responses
  • Console supports copy path functionality

Limitations:
  • Basic formatting only
  • No advanced search
  • Can crash with large responses (>10MB)

Online JSON Viewers

BigJSON Viewer - Best for large files:
  • ✅ Handles 100MB+ files without lag
  • ✅ Tree view with path copying
  • ✅ One-click formatting
  • ✅ Client-side processing (100% private)
  • ✅ Search and filter capabilities

JSONLint - Good for validation:
  • ✅ Syntax validation
  • ✅ Error highlighting
  • ❌ Limited navigation features

IDE Extensions

VS Code:
  • "JSON Tools" extension
  • "Pretty JSON" for formatting
  • Built-in JSON schema validation

Postman:
  • Integrated JSON viewer
  • Response history
  • Test generation

---

Essential JSON Viewer Techniques

1. Quick Path Extraction

The Problem:

You need to access user.profile.settings.notifications.email from an API response.

Without JSON Viewer:
// Manual drilling - error-prone!

const email = response.user.profile.settings.notifications.email;

With BigJSON Viewer:
  • Click on the target field
  • Copy path with one click
  • Get: user.profile.settings.notifications.email
  • Pro Tip: Use JSONPath syntax for more complex queries:
    $.user.profile.settings.notifications.email
    

    $.users[].email // All user emails

    $.products[?(@.price < 100)].name // Products under $100

    2. Collapse/Expand Strategy

    The Technique:

    Start collapsed, expand strategically.

    Example - Debugging User API:
    {
    

    "status": "success", // ← Keep visible

    "metadata": { ... }, // ← Collapse initially

    "users": [ // ← Keep visible

    {

    "id": 1,

    "profile": { ... }, // ← Expand when investigating user

    "permissions": { ... } // ← Collapse initially

    }

    ],

    "debug": { ... } // ← Collapse unless debugging

    }

    BigJSON Viewer Shortcuts:
    • Click arrow to expand/collapse
    • Double-click to expand all children
    • Right-click for "Expand All" / "Collapse All"

    3. Type-Based Navigation

    Understanding Data Types at a Glance:

    Modern JSON viewers use color coding:

    {
    

    "string": "blue text", // 🔵 Strings in blue

    "number": 42, // 🟢 Numbers in green

    "boolean": true, // 🟠 Booleans in orange

    "null": null, // ⚫ Null in gray

    "array": [], // 🟣 Arrays with brackets

    "object": {} // 🟤 Objects with braces

    }

    Why This Matters:

    Spot data type issues instantly:

    {
    

    "userId": "123", // 🔵 Should this be a number?

    "price": "29.99", // 🔵 Probably wrong - should be number

    "active": "true" // 🔵 Should be boolean, not string!

    }

    ---

    Debugging Real API Responses

    Scenario 1: Missing Expected Data

    API Response:
    {
    

    "status": 200,

    "data": {

    "users": [

    { "id": 1, "name": "Alice" },

    { "id": 2, "name": "Bob" }

    ]

    }

    }

    Expected but Missing: email field Debugging Steps with JSON Viewer:
  • Search for "email" - Use Cmd/Ctrl + F
  • - No results? Field truly missing, not just nested

  • Check API documentation - Compare expected vs actual structure
  • Inspect similar objects - Are other users missing email too?
  • Verify request parameters - Maybe email requires ?fields=email
  • Pro Tip: Create a reference JSON schema:
    // expected-user-schema.json
    

    {

    "id": "number",

    "name": "string",

    "email": "string", // ← Missing in actual response!

    "avatar": "string"

    }

    Scenario 2: Nested Error Messages

    API Error Response:
    {
    

    "status": 400,

    "error": {

    "code": "VALIDATION_ERROR",

    "message": "Invalid request",

    "details": {

    "fields": {

    "email": {

    "errors": [

    {

    "code": "INVALID_FORMAT",

    "message": "Email must be valid format"

    }

    ]

    }

    }

    }

    }

    }

    Quick Navigation:
  • Expand errordetailsfieldsemail
  • Copy path: error.details.fields.email.errors[0].message
  • Use in code:
  • const errorMsg = response?.error?.details?.fields?.email?.errors?.[0]?.message;
    

    console.error('Validation error:', errorMsg);

    Scenario 3: Performance Issues (Large Responses)

    The Problem:

    API returns 50,000 products, browser freezes.

    Solution with BigJSON Viewer:
  • Use streaming mode - Load data progressively
  • Filter before viewing - Apply JSON filters:
  • $.products[?(@.inStock === true)]

  • Download subset - Extract only what you need
  • Pagination Strategy:
    // Instead of fetching everything:
    

    GET /api/products?limit=1000 // ❌ Heavy

    // Fetch in pages:

    GET /api/products?page=1&limit=50 // ✅ Manageable

    ---

    Advanced JSON Viewer Tips

    1. Compare Two API Responses

    Use Case: API behavior changed between versions. Technique:
    // Capture responses
    

    const v1Response = await fetch('/api/v1/user');

    const v2Response = await fetch('/api/v2/user');

    // Use online diff tools

    // BigJSON provides side-by-side comparison

    What to Look For:
    • Missing fields
    • Type changes ("123"123)
    • Structure changes (object → array)
    • New fields added

    2. Extract Specific Data Patterns

    JSONPath Examples:
    // All email addresses
    

    $.users[].email

    // Products over $100

    $.products[?(@.price > 100)]

    // Users with admin role

    $.users[?(@.role === 'admin')]

    // Nested array search

    $..comments[].author.name

    Use BigJSON's JSONPath Evaluator:
  • Paste your JSON
  • Enter JSONPath query
  • See matched results instantly
  • 3. Validate Against Schema

    JSON Schema Example:
    {
    

    "$schema": "http://json-schema.org/draft-07/schema#",

    "type": "object",

    "properties": {

    "userId": { "type": "number" },

    "email": {

    "type": "string",

    "format": "email"

    },

    "created": {

    "type": "string",

    "format": "date-time"

    }

    },

    "required": ["userId", "email"]

    }

    Validation in BigJSON:
    • Upload schema
    • Validate response
    • See violations highlighted

    4. Save & Share API Responses

    Workflow:
  • Capture response - Save API output to file
  • Anonymize sensitive data - Remove tokens, passwords
  • Share with team - Upload to shared workspace
  • Add annotations - Comment on specific fields
  • Example - Sharing with Support Team:
    {
    

    "_comment": "Error occurs when creating order with invalid coupon",

    "orderId": "ORD-12345",

    "error": {

    "code": "INVALID_COUPON",

    "message": "Coupon XYZ123 is expired"

    }

    }

    ---

    Browser DevTools Debugging Workflow

    Chrome DevTools Pro Tips

    1. Preserve Network Logs
    • Right-click Network tab → Check "Preserve log"
    • Keeps API calls visible during page navigations

    2. Filter XHR/Fetch Requests
    • Click "XHR" or "Fetch" in Network tab
    • Hides CSS, images, scripts

    3. Copy as cURL
    • Right-click request → Copy → Copy as cURL
    • Replay exact API call in terminal

    4. Initiator Column
    • Shows which JavaScript triggered the API call
    • Click to jump to source code

    5. Response Size
    • Check "Size" column for payload size
    • Identify heavy API responses

    Firefox Developer Tools

    JSON Viewer Features:
    • Automatic JSON detection in responses
    • Collapsible tree view
    • RAW/Parsed toggle
    • JSONPath-like search

    How to Use:
  • Open Network tab
  • Click API request
  • Click "Response" tab
  • Enjoy formatted JSON
  • ---

    Debugging Common API Issues

    Issue 1: CORS Errors

    Symptom:
    Access to fetch at 'https://api.example.com' from origin 'http://localhost:3000' 
    

    has been blocked by CORS policy

    Debugging:
  • Check Network tab → Response headers
  • Look for:
  • Access-Control-Allow-Origin: 

    Access-Control-Allow-Methods: GET, POST

  • Verify request headers match allowed headers
  • Quick Fix for Development:
    // Use proxy in package.json (React)
    

    {

    "proxy": "https://api.example.com"

    }

    // Or use CORS proxy for testing

    fetch('https://cors-anywhere.herokuapp.com/https://api.example.com/data')

    Issue 2: Authentication Failures

    Expected Response:
    {
    

    "data": { ... }

    }

    Actual Response:
    {
    

    "error": "Unauthorized",

    "message": "Invalid or expired token"

    }

    Debugging Checklist:
    • [ ] Token included in request?
    • [ ] Correct header name? (Authorization: Bearer )
    • [ ] Token expired? Check exp claim in JWT
    • [ ] Token format correct? (JWT vs API key)

    Inspect Headers in DevTools:
    Request Headers:
    

    Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

    Issue 3: Unexpected Data Types

    Problem:
    const response = await fetch('/api/user/123');
    

    const data = await response.json();

    // Expecting number, got string

    console.log(typeof data.userId); // "string" ❌

    Debugging with JSON Viewer:
  • Inspect actual response structure
  • Check type highlighting
  • Add type conversion:
  • const userId = Number(data.userId);  // Convert string to number
    

    const price = parseFloat(data.price); // Parse float

    const active = data.active === 'true'; // String to boolean

    ---

    Tools & Extensions for Pro Debugging

    Browser Extensions

    1. JSON Formatter (Chrome/Firefox)
    • Auto-formats JSON in browser
    • Syntax highlighting
    • Collapse/expand nodes

    2. JSONView (Chrome/Edge)
    • Tree view for JSON
    • Copy keys and values
    • Clickable URLs

    3. REST Client (VS Code)
    • Make API calls directly in VS Code
    • Save request collections
    • Environment variables

    Command-Line Tools

    cURL - Make API Requests:
    # Basic GET request
    

    curl https://api.example.com/users

    # Pretty print with jq

    curl https://api.example.com/users | jq .

    # Save response

    curl https://api.example.com/users > response.json

    # Include headers in output

    curl -i https://api.example.com/users

    jq - JSON Processor:
    # Extract specific field
    

    cat response.json | jq '.users[0].email'

    # Filter array

    cat response.json | jq '.users[] | select(.active == true)'

    # Transform data

    cat response.json | jq '.users | map({id, name})'

    httpie - User-Friendly HTTP Client:
    # Clean syntax
    

    http GET https://api.example.com/users

    # POST with JSON

    http POST https://api.example.com/users name=Alice email=alice@example.com

    # Automatic JSON formatting

    http https://api.example.com/users --pretty=all

    Desktop Applications

    Postman:
    • Collection management
    • Environment variables
    • Automated testing
    • Mock servers

    Insomnia:
    • Clean interface
    • GraphQL support
    • Code generation
    • Plugin ecosystem

    Paw (macOS):
    • Beautiful UI
    • Dynamic values
    • Team synchronization

    ---

    Creating a Debugging Workflow

    Step-by-Step Process

    1. Capture the Request
    # Save request details
    

    curl 'https://api.example.com/data' \

    -H 'Authorization: Bearer TOKEN' \

    -H 'Content-Type: application/json' \

    --data '{"query":"test"}' \

    > request.txt

    2. Inspect the Response
    • Open in BigJSON Viewer
    • Check status code
    • Verify response structure

    3. Compare with Documentation
    • Expected vs actual fields
    • Type mismatches
    • Missing data

    4. Test Variations
    • Change parameters
    • Try different endpoints
    • Modify headers

    5. Document Findings
    <h2 id="bug-report-user-api-returns-null-email" class="text-2xl font-bold mt-10 mb-5 text-foreground border-b border-gray-200 dark:border-gray-700 pb-2">Bug Report: User API Returns Null Email</h2>
    
    Endpoint: GET /api/users/123  
    Expected: { "email": "user@example.com" }  
    Actual: { "email": null }  
    Steps: User must verify email first  
    Fix: Add email verification check

    ---

    Best Practices

    DO:

    Use version control for API examples

    git/
    

    ├── api-examples/

    │ ├── users-get-200.json

    │ ├── users-get-404.json

    │ └── users-post-201.json

    Create reusable test cases

    describe('User API', () => {
    

    it('returns user with email', async () => {

    const response = await fetch('/api/users/1');

    const data = await response.json();

    expect(data.email).toBeDefined();

    });

    });

    Document API quirks

    // Note: API returns price as string, not number
    

    const price = parseFloat(response.price);

    DON'T:

    Log sensitive data

    // ❌ Bad
    

    console.log('User response:', response); // May contain tokens!

    // ✅ Good

    console.log('User fetched:', { id: response.id, name: response.name });

    Assume response structure

    // ❌ Bad
    

    const email = response.user.email; // Crashes if user is null

    // ✅ Good

    const email = response?.user?.email ?? 'No email';

    Ignore error responses

    // ❌ Bad
    

    const data = await fetch('/api/data').then(r => r.json());

    // ✅ Good

    const response = await fetch('/api/data');

    if (!response.ok) {

    const error = await response.json();

    console.error('API error:', error);

    throw new Error(error.message);

    }

    const data = await response.json();

    ---

    Conclusion

    Master API debugging by:

  • Choose the right JSON viewer - Use BigJSON for large files
  • Learn keyboard shortcuts - Navigate 10x faster
  • Use JSONPath - Find data precisely
  • Validate against schemas - Catch type mismatches
  • Build a debugging workflow - Consistent process = faster fixes
  • Your Next Steps

  • Try BigJSON Viewer - Handle any API response size
  • Install browser extensions - JSON Formatter or JSONView
  • Learn jq - Command-line JSON mastery
  • Set up Postman collections - Save time on repeated API calls
  • Bookmark this guide - You'll reference it every time you debug APIs!

    ---

    ---

    Last updated: February 15, 2026
    Share:

    Related Articles

    Read in other languages