Nested JSON to CSV Converter — Flatten Deep JSON to CSV

Convert JSON arrays to CSV — nested flattening · custom delimiter · live preview · Excel download · 100% Free

JSON INPUT
⚙ OPTIONS
CSV OUTPUT
CSV output appears here
Paste JSON on the left · click a Sample · or drop a .json file
Ctrl+Enter ConvertCtrl+Shift+C CopyCtrl+L ClearCtrl+S DownloadV PreviewP Pin
💡

Real-world API JSON is rarely flat — it has nested objects, arrays within objects, and objects within arrays. Flattening this to CSV requires smart decisions about how to handle each level. This converter uses dot-notation flattening with configurable depth, array handling strategies and a preview table so you see exactly what your CSV will look like before downloading.

📌 Deeply Nested JSON Flattening
{"user":{"id":1,"address":{"city":"Mumbai","pin":"400001"},"orders":[{"id":"O1"},{"id":"O2"}]}}
user.id, user.address.city, user.address.pin, user.orders.0.id, user.orders.1.id — 5 columns from 4-level nesting

What is JSON to CSV Conversion?

JSON to CSV conversion transforms JavaScript Object Notation (JSON) data into Comma Separated Values (CSV) — a flat, plain-text format that can be opened in Microsoft Excel, Google Sheets, LibreOffice Calc, or imported into any database. CalcNation's JSON to CSV converter handles nested objects, arrays, inconsistent keys, and custom delimiters — all 100% in your browser.

Options Explained

Flatten Nested JSON — Converts nested objects to dot-notation columns. E.g. { "address": { "city": "X" } } becomes the column address.city. Flatten Arrays — Expands array items to separate columns: tags[0], tags[1]Delimiter — Choose comma (standard), semicolon (European Excel), tab (TSV for Excel paste), pipe, or a custom character. Header Row — Toggle whether the first CSV row contains column names.

Frequently Asked Questions

How does dot-notation flattening work for nested JSON?

Dot-notation flattening: {"a":{"b":{"c":1}}} → {"a.b.c": 1}. Each nesting level adds a dot separator. Arrays use numeric indices: {"items":[{"id":1},{"id":2}]} → {"items.0.id": 1, "items.1.id": 2}. The result is a flat key-value structure suitable for CSV. Depth limit: choose how many levels to flatten (1, 2, all).

What are the strategies for handling JSON arrays in CSV flattening?

Four strategies: (1) Index columns: items.0.id, items.1.id, items.2.id — creates one column per array item. (2) Join: items joined as "item1|item2|item3" in one column. (3) First only: only items.0.* columns. (4) Separate rows: one CSV row per array item (data repeated for parent fields). Strategy depends on analysis need.

Can I flatten JSON with arrays of different lengths?

Yes — with index strategy, columns are created for the maximum array length found across all records. Records with shorter arrays have empty values for extra columns. Example: one record has 3 items, another has 5 → CSV has items.0.* through items.4.* columns. Records with 3 items show empty for items.3.* and items.4.*.

What is the best way to handle JSON arrays that should become multiple CSV rows?

For "explode array" (one row per array item): this is equivalent to SQL JOIN. Example: {"order":"O1","items":[{"sku":"A"},{"sku":"B"}]} → two CSV rows: O1,A and O1,B (order data repeated). This is useful for analysis where you want to aggregate by item. Tools: pandas df.explode("items"), jq ".[] | .items[] + {order: .id}".