API Debug Workflow: Clean JSON → Query with JSONPath → Export to CSV
You call an API and get back minified JSON with hundreds of nested objects. You need to find specific users, extract their email addresses, and export them to CSV for further analysis. This guide walks through a complete API debugging workflow using three interconnected tools.
The Scenario: Debug a User API Response
Problem: A third-party API returns a complex JSON response with user data. You need to:
- Read the messy, minified JSON
- Find all active users in the "engineering" department
- Extract their names, emails, and join dates
- Export to CSV for importing into another system
Raw API Response (Minified)
{"status":"success","data":{"users":[{"id":1,"name":"Alice Johnson","email":"alice@company.com","department":"engineering","active":true,"joinDate":"2024-03-15"},{"id":2,"name":"Bob Smith","email":"bob@company.com","department":"sales","active":true,"joinDate":"2024-01-10"},{"id":3,"name":"Charlie Brown","email":"charlie@company.com","department":"engineering","active":false,"joinDate":"2023-11-20"},{"id":4,"name":"Diana Prince","email":"diana@company.com","department":"engineering","active":true,"joinDate":"2025-02-01"},{"id":5,"name":"Eve Davis","email":"eve@company.com","department":"marketing","active":true,"joinDate":"2024-08-12"}],"totalCount":5,"timestamp":"2026-01-21T10:30:00Z"}}This is impossible to read. Let's walk through the complete workflow step by step.
Step 1: Format the JSON for Readability
Tool: JSON Formatter
Goal: Transform minified JSON into human-readable format with proper indentation.
Actions
- Open the JSON Formatter
- Paste the minified JSON into the input area
- Click "Format" or press Ctrl+Enter
- Set indentation to 2 spaces for readability
Formatted Output
{
"status": "success",
"data": {
"users": [
{
"id": 1,
"name": "Alice Johnson",
"email": "alice@company.com",
"department": "engineering",
"active": true,
"joinDate": "2024-03-15"
},
{
"id": 2,
"name": "Bob Smith",
"email": "bob@company.com",
"department": "sales",
"active": true,
"joinDate": "2024-01-10"
},
{
"id": 3,
"name": "Charlie Brown",
"email": "charlie@company.com",
"department": "engineering",
"active": false,
"joinDate": "2023-11-20"
},
{
"id": 4,
"name": "Diana Prince",
"email": "diana@company.com",
"department": "engineering",
"active": true,
"joinDate": "2025-02-01"
},
{
"id": 5,
"name": "Eve Davis",
"email": "eve@company.com",
"department": "marketing",
"active": true,
"joinDate": "2024-08-12"
}
],
"totalCount": 5,
"timestamp": "2026-01-21T10:30:00Z"
}
}Result: Now you can see the structure. There are 5 users with different departments and active statuses.
Step 2: Query Data with JSONPath
Tool: JSONPath Tester
Goal: Filter users to find only active engineering team members.
Finding Active Engineering Users
JSONPath Expression:
$.data.users[?(@.department == 'engineering' && @.active == true)]Actions
- Open the JSONPath Tester
- Paste the formatted JSON into the JSON input
- Enter the JSONPath expression in the query field
- Click "Test" to see results
Query Result
[
{
"id": 1,
"name": "Alice Johnson",
"email": "alice@company.com",
"department": "engineering",
"active": true,
"joinDate": "2024-03-15"
},
{
"id": 4,
"name": "Diana Prince",
"email": "diana@company.com",
"department": "engineering",
"active": true,
"joinDate": "2025-02-01"
}
]Result: Filtered from 5 users down to 2 active engineering team members.
Extract Specific Fields
If you only need names and emails, refine the query:
$.data.users[?(@.department == 'engineering' && @.active == true)].['name','email','joinDate']Result:
[
{
"name": "Alice Johnson",
"email": "alice@company.com",
"joinDate": "2024-03-15"
},
{
"name": "Diana Prince",
"email": "diana@company.com",
"joinDate": "2025-02-01"
}
]Step 3: Export to CSV for Analysis
Tool: JSON to CSV Converter
Goal: Convert the filtered JSON results into CSV format for spreadsheet analysis or database import.
Actions
- Copy the filtered JSON result from the JSONPath Tester
- Open the JSON to CSV Converter
- Paste the filtered JSON into the input
- Click "Convert to CSV"
- Download or copy the CSV output
CSV Output
name,email,joinDate
Alice Johnson,alice@company.com,2024-03-15
Diana Prince,diana@company.com,2025-02-01Result: Clean CSV ready for Excel, Google Sheets, or database import.
Complete Workflow Summary
1. Format JSON
Input: Minified API response (1 line, unreadable)
Tool: JSON Formatter
Output: Readable, indented JSON (50 lines, structured)
2. Query with JSONPath
Input: Formatted JSON (all 5 users)
Tool: JSONPath Tester
Expression: $.data.users[?(@.department == 'engineering' && @.active == true)]
Output: Filtered JSON (2 matching users)
3. Export to CSV
Input: Filtered JSON (2 users)
Tool: JSON to CSV Converter
Output: CSV file (2 rows + header)
Final Result: CSV with active engineering users ready for analysisAdvanced Use Cases
Case 1: Extract Nested Data
Scenario: Users have nested address objects.
{
"users": [
{
"name": "Alice",
"address": {
"city": "San Francisco",
"state": "CA"
}
}
]
}JSONPath to flatten:
$.users[*].['name', 'address.city', 'address.state']Case 2: Filter by Date Range
Find users who joined after 2024-06-01:
$.data.users[?(@.joinDate > '2024-06-01')]Case 3: Count Results
How many active users?
$.data.users[?(@.active == true)].lengthCommon API Debugging Patterns
Pattern 1: Paginated Responses
{
"data": {
"results": [...],
"pagination": {
"page": 1,
"perPage": 10,
"total": 150
}
}
}
// Extract all results across pages
$.data.results[*]Pattern 2: Error Handling
{
"status": "error",
"errors": [
{"field": "email", "message": "Invalid format"},
{"field": "age", "message": "Must be positive"}
]
}
// Extract error messages
$.errors[*].message
// Result: ["Invalid format", "Must be positive"]Pattern 3: Deep Nesting
{
"company": {
"departments": [
{
"name": "Engineering",
"teams": [
{
"name": "Backend",
"members": [...]
}
]
}
]
}
}
// Recursive descent to find all members
$..members[*]Workflow Tips
- Always format first: Reading minified JSON leads to mistakes
- Test JSONPath incrementally: Start broad (
$.data.users), then add filters - Validate JSON before querying: Use the JSON Formatter to catch syntax errors
- Check CSV structure: Ensure nested arrays are flattened correctly
- Save intermediate results: Copy formatted JSON and query results for reference
Troubleshooting Common Issues
Issue: JSONPath Returns Empty Array
Cause: Incorrect path or filter expression
Fix: Test path components separately:
// Test each level
$.data
$.data.users
$.data.users[0]
$.data.users[0].department
// Then add filters
$.data.users[?(@.department == 'engineering')]Issue: CSV Export Looks Wrong
Cause: Nested objects or arrays not flattened
Fix: Use JSONPath to extract specific fields before converting:
// Instead of full objects with nested data:
$.users[*]
// Extract only flat fields:
$.users[*].['id', 'name', 'email']Issue: Special Characters in CSV
Cause: Values contain commas, quotes, or newlines
Fix: The JSON to CSV Converter automatically handles escaping. If importing fails, try TSV format instead.
Real-World Example: GitHub API
Scenario: Extract repository names and star counts from GitHub search API.
Step 1: Fetch and Format
curl "https://api.github.com/search/repositories?q=language:typescript&sort=stars" \
| pbcopy
# Paste into JSON FormatterStep 2: Query with JSONPath
// Extract top 5 repos by stars
$.items[0:5].['name', 'stargazers_count', 'html_url']Step 3: Export to CSV
name,stargazers_count,html_url
typescript,89432,https://github.com/microsoft/typescript
vscode,145234,https://github.com/microsoft/vscode
...Tools Used in This Workflow
- JSON Formatter - Format, minify, and validate JSON with syntax error detection
- JSONPath Tester - Query and filter JSON data with JSONPath expressions
- JSON to CSV Converter - Export JSON arrays to CSV/TSV format for spreadsheet analysis
Summary
The complete API debugging workflow:
- Format: Make JSON readable with JSON Formatter
- Query: Filter and extract data with JSONPath Tester
- Export: Convert to CSV with JSON to CSV Converter
This workflow transforms raw API responses into actionable data in minutes. No scripting required—just three browser-based tools working together.