AdvancedAction GuideUpdated regularly5 min read

Flatten Deeply Nested JSON API Responses to CSV

REST API responses from platforms like Shopify, Stripe, and HubSpot return deeply nested JSON structures where critical data lives inside arrays — order.line_items[], charge.refunds[], deal.products[]. Naive JSON-to-CSV converters handle nested objects via dot-notation flattening (address.city, address.zip), but they fail catastrophically on arrays. When encountering line_items: [{"sku": "A", "qty": 2}, {"sku": "B", "qty": 1}], these tools either drop the array entirely or serialize the entire array into a single cell as the literal string [object Object], rendering the data useless for downstream analysis. The correct approach requires two strategies: dot-notation flattening for nested objects and array explosion for nested arrays (one order with 3 line items becomes 3 CSV rows, each carrying the parent order's metadata). This workflow parses your JSON, detects array vs. object structures at every depth level, applies dot-notation to objects, and explodes arrays into separate rows while duplicating parent-level fields.

Why this matters?

A revenue operations analyst pulled 18 months of Shopify order data via the Admin API, receiving a 67MB JSON file with 94,000 orders — each containing a line_items array (average 2.3 items per order) and a refunds array. Using an online JSON-to-CSV converter, the line_items column appeared as [object Object] in every row, making product-level revenue analysis impossible. The analyst then attempted a Python script with json_normalize(), but it flattened arrays into semicolon-separated strings that couldn't be pivoted in Excel without complex text parsing. The correct output — exploding 94,000 orders into 216,000 line-item-level rows with parent order metadata duplicated — revealed that 23% of revenue came from a product category the merchandising team had been understocking, information that was literally invisible in the [object Object] output.

The 3-Step Solution

Follow this streamlined workflow to transform your raw data export into a clean, analysis-ready dataset. Each step leverages our browser-based tools to ensure your sensitive data never leaves your device.

By following these three steps, you eliminate manual data wrangling, reduce human error, and maintain full GDPR compliance throughout the process.

Ready to clean your data?

100% local processing. Zero uploads. Blazing fast.

Recommended Tools

Related Workflows

Sample Datasets