ToolBoxOnline
Developer Tools

JSON to CSV Nested Data Flattening vs Manual Excel Import

Nested JSON objects and arrays don't fit into flat CSV columns. Here's how flattening strategies compare to manual Excel data import for real-world datasets.

JSON to CSVnested JSONdata flatteningExcel importdata pipeline

You exported your analytics data as JSON. It's a 200MB file with nested objects three levels deep. You need to open it in Excel for your manager, who wants a pivot table by end of day. You have two choices: (1) manually flatten it in Excel for four hours, or (2) use a JSON to CSV converter that handles nested data in 30 seconds.

The catch: JSON to CSV conversion of nested data isn't straightforward. You have to make decisions about how to flatten the structure, and each decision has trade-offs.

The Problem: JSON Trees vs CSV Tables

JSON is a tree. Each object can contain other objects and arrays, which can contain more objects and arrays, to any depth. CSV is a table. Each row has the same columns, and each cell contains a single value. Converting a tree to a table requires flattening — deciding how to collapse nested structures into flat columns.

Consider a user object with an address: {"name": "Alice", "address": {"street": "123 Main", "city": "Springfield", "zip": "62701"}}. The simplest flattening creates columns like address.street, address.city, address.zip. This works for one level of nesting but gets unwieldy fast.

Arrays: The Real Headache

Objects nest neatly into dot-notation columns. Arrays are messier. A user with multiple phone numbers — ["555-0100", "555-0101"] — doesn't fit into a single cell. Your options:

Explode into multiple rows: Create one row per array element. Alice with two phone numbers becomes two rows, each with one phone number and the rest of Alice's data duplicated. This preserves all data but inflates row count and makes aggregation harder.

Join into a single cell: Store all phone numbers in one cell, separated by commas or pipes: 555-0100|555-0101. This keeps one row per user but breaks Excel's ability to filter or sort by phone number.

Explode into multiple columns: Create phone_0, phone_1, phone_2 columns up to the maximum array length. Clean but fragile — add a user with three phone numbers and your schema breaks.

Flattening Strategy Decision Tree

Use dot-notation columns (address.city) when: nesting depth ≤ 3, every object has the same keys, and column count stays under 50. This is the most Excel-friendly format.

Use row explosion when: arrays contain the primary data you need to analyze, each array element is independently meaningful, and you're loading into a database or BI tool (not Excel).

Use JSON columns (keep nested objects as JSON strings in cells) when: the nested data is metadata that won't be filtered or sorted, and you need to preserve the exact original structure for later programmatic processing.

Manual Excel vs Automated Conversion

Excel's "Get Data from JSON" (Power Query) handles one level of nesting automatically. Beyond that, you're manually expanding columns and writing M formulas. For a one-time conversion of a small file, Power Query is fine. For anything you'll do more than once, or files over 10MB, automated JSON to CSV conversion saves hours and produces consistent results.

For converting nested JSON to CSV, use our JSON to CSV converter with flattening options. For inspecting the JSON structure before conversion, our JSON formatter shows the full tree. And for converting CSV back to JSON after Excel editing, our CSV to JSON converter handles the reverse direction.

Tools mentioned in this article

Share this tool