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 Team
• Technical WriterExpert in JSON data manipulation, API development, and web technologies. Passionate about creating tools that make developers' lives easier.
# 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
- 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
- ✅ Syntax validation
- ✅ Error highlighting
- ❌ Limited navigation features
IDE Extensions
VS Code:- "JSON Tools" extension
- "Pretty JSON" for formatting
- Built-in JSON schema validation
- 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.
// Manual drilling - error-prone!
const email = response.user.profile.settings.notifications.email;
With BigJSON Viewer:
user.profile.settings.notifications.email$.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:
- No results? Field truly missing, not just nested
?fields=email// 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:
error → details → fields → emailerror.details.fields.email.errors[0].messageconst 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:
$.products[?(@.inStock === true)]
// 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:
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:{
"_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
- Click "XHR" or "Fetch" in Network tab
- Hides CSS, images, scripts
- Right-click request → Copy → Copy as cURL
- Replay exact API call in terminal
- Shows which JavaScript triggered the API call
- Click to jump to source code
- 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
---
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:
Access-Control-Allow-Origin:
Access-Control-Allow-Methods: GET, POST
// 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
expclaim in JWT - [ ] Token format correct? (JWT vs API key)
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:
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
- Tree view for JSON
- Copy keys and values
- Clickable URLs
- 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
- Clean interface
- GraphQL support
- Code generation
- Plugin ecosystem
- 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
- Expected vs actual fields
- Type mismatches
- Missing data
- Change parameters
- Try different endpoints
- Modify headers
<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:
Your Next Steps
---
Related Resources
---
Last updated: February 15, 2026Related Articles
Best JSON Online Tools 2026: Viewers, Validators, and Formatters
Comprehensive guide to the best JSON online tools. Compare viewers, validators, formatters, and converters for working with JSON data.
JavaScript JSON: Parse, Stringify, and Best Practices
Complete guide to JSON in JavaScript. Learn JSON.parse(), JSON.stringify(), error handling, and advanced techniques for web development.
JSON APIs and REST Services: Complete Development Guide
Learn to build and consume JSON-based REST APIs. Covers HTTP methods, authentication, best practices, and real-world implementation examples.