JSON Beautifier
Guide · 4 min read

Flatten Nested JSON to CSV

To convert nested JSON to CSV, flatten each nested object into flat columns using dot notation (e.g. address.city), and keep arrays as JSON or join their values in one cell. CSV is the universal format for spreadsheets and analytics, but most APIs return nested JSON. This guide explains exactly how flattening works and how to handle arrays, deep nesting, and common edge cases.

JSON Array
CSV (ready for Excel / Sheets)
[
  {
    "name": "Alice",
    "city": "New York",
    "score": 95,
    "active": true
  },
  {
    "name": "Bob",
    "city": "Los Angeles",
    "score": 87,
    "active": false
  },
  {
    "name": "Carol",
    "city": "Chicago",
    "score": 92,
    "active": true
  }
]

How to Convert JSON to CSV — 3 Steps

1
Prepare your JSON array
Use a JSON object or an array of objects. Each object becomes one row, and fields from every record contribute columns.
2
Paste into the JSON to CSV converter
Open the JSON to CSV tool and paste your JSON array. The converter detects all keys automatically and builds the header row.
3
Download the CSV
Click Download to save the .csv file, then open it in Excel, Google Sheets, or any spreadsheet tool. No reformatting needed.

How Nested Objects Are Flattened

CSV is a flat format — it has rows and columns but no nesting. When you convert JSON with nested objects, the converter flattens nested keys using dot notation:

Nested JSON
{
  "name": "Alice",
  "address": {
    "city": "NYC",
    "zip": "10001"
  }
}
Flattened CSV
name,address.city,address.zip
Alice,NYC,10001

The nested address object becomes two columns: address.city and address.zip.

How Nested Arrays Are Handled

Arrays remain in one cell. Choose Keep as JSON to retain their structure, or Join with semicolons for a readable list. With joining enabled, when a field contains an array of values (e.g. "tags": ["web", "api"]), the converter joins the values into a single cell separated by semicolons:

tags
web;api

Arrays of objects stay in one cell as JSON. With joining enabled, each object is serialized before joining. To turn each array element into a separate row, first reshape your data with a script for your chosen table layout.

Common Use Cases for JSON to CSV Conversion

API data to spreadsheet: Export user lists, orders, analytics events, or any JSON array from an API directly into Excel or Google Sheets for analysis.
Database exports: MongoDB and DynamoDB export data as JSON. Convert to CSV for import into PostgreSQL, MySQL, or a BI tool like Tableau.
Reporting and sharing: Non-technical stakeholders can open CSV files in Excel without any tools. Share data exports as CSV instead of raw JSON.
Data migration: When migrating between systems, CSV is often the lowest-common-denominator import format accepted by almost every platform.

Convert JSON to CSV Now

Paste your JSON array and download a CSV in seconds — free, no sign-up.

Open JSON to CSV

Related Guides