Flatten Nested JSON to CSV
When you want every leaf field of a nested JSON to become its own CSV column, you want a full flatten.
Native JSON tool
JSON to CSV
Full recursive flatten
Dot or underscore separator
Handles arrays gracefully
Configurable max depth
- Cost
- Free tier
- Sign-up
- Not required
- Processing
- Tool-specific
- Privacy
- Clearly disclosed
Add this JSON to CSV to your website
Drop the JSON to CSV into a blog post, product docs, intranet, or school portal with one iframe. Processing, privacy, and usage limits are the same as on the full tool page.
- One copy-ready line of HTML
- Responsive — adapts to any container width
- No API credentials are placed in the snippet
Embed code
<iframe
src="https://www.fixtools.io/json/json-to-csv?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="JSON to CSV by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
How recursive flattening works in practice
The flatten algorithm walks the JSON tree depth-first. Each leaf value (a string, number, boolean, or null) becomes a CSV cell, and the column name is the path from the root to the leaf, joined with the chosen separator. The path { customer: { address: { city: "London" } } } produces a column named customer.address.city with the value London. This convention scales to arbitrary depth and is the same approach used by pandas json_normalize, jq path expressions, and most data warehouses.
Arrays are the interesting case. When an array contains primitives, the array becomes a JSON-encoded cell by default, preserving the values without exploding the row count. When an array contains objects, you have a choice: JSON-encode the whole array as a cell, explode each element into a separate row by duplicating parent fields, or include only the first element flattened with an index suffix. Each choice has trade-offs. JSON-encoding preserves information but is opaque to spreadsheets. Exploding produces analyst-friendly rows but multiplies row count. Index-suffixing produces a fixed-width row at the cost of dropping array elements beyond the first.
Maximum depth is the dial that prevents column explosion. A JSON tree with five levels of branching, three keys per level, produces 243 leaf paths if all branches are present. Most analysts get overwhelmed by more than 50 columns. Capping depth at 2 or 3 produces a manageable column count while preserving the most-used fields, and remaining depth stays as JSON-encoded cells that can be re-parsed if needed. FixTools shows the projected column count for each depth setting so you can pick the right one before downloading.
Underscore vs dot separator is mostly a downstream-tool consideration. Dots are more readable for humans but conflict with some SQL dialects where dot is the table-column separator. Underscores are uglier but universally accepted in column names. If your downstream is BigQuery or Snowflake, dots work fine. If your downstream is older Postgres or MySQL, switch to underscores to avoid quoting issues.
How to use this tool
Recursively flatten nested JSON into a wide CSV with one column per leaf field, using dot or underscore separator.
How It Works
Step-by-step guide to flatten nested json to csv:
- 1
Paste JSON
Paste your nested JSON. The parser shows the maximum nesting depth and projected leaf-field count.
- 2
Pick max depth and separator
Choose how deep to flatten and whether to join with dots or underscores. The projected column count updates so you can pick a manageable width.
- 3
Choose array handling
Decide whether arrays JSON-encode, explode into rows, or index-suffix into separate columns. Each has trade-offs explained in the panel.
- 4
Preview and download
Inspect the preview. If the column count is too high, lower the depth. If the row count is too high after exploding, switch arrays back to JSON-encoded cells.
Real-world examples
Common situations where this approach makes a real difference:
Pipeline feed for BigQuery
A data engineer flattens nested JSON fully so the resulting CSV maps directly to BigQuery columns. Dot separator works because BigQuery handles dotted column names natively.
Analyst pivot in Sheets
A marketing analyst flattens to depth 2 to expose the most useful fields as filterable columns while keeping deep noise as JSON-encoded cells. The analyst pivots in Google Sheets without column-count overwhelm.
Survey response analysis
A researcher flattens nested demographics and exploded option arrays so each response becomes one row per selected option. This shape lets them pivot by option in Excel directly.
Migration to relational schema
A database engineer flattens JSON to depth-3 for a one-time migration into Postgres. Underscore separator avoids dot-quoting issues in the SQL bulk-load step.
Pro tips
Get better results with these expert suggestions:
Project column count before flattening
The converter shows the projected column count for each depth setting. Pick the lowest depth that still exposes the fields your audience needs, to keep the CSV readable.
Avoid full flatten for opaque metadata
If your JSON contains opaque metadata blobs (like internal version, hashes, audit fields), full flatten produces noise columns. Cap depth above those fields or exclude them in the preview.
Pair explode with row-limit safeguards
Exploding arrays multiplies row count by array length. Check the projected row count before committing, and switch to JSON-encoded cells if the count exceeds what your downstream tool can handle.
Use underscore for non-modern SQL
BigQuery and Snowflake handle dotted column names. Older Postgres, MySQL, and Oracle versions need underscores or careful quoting. Switch the separator early to avoid downstream rework.
Frequently asked questions
Related guides
More use-case guides for the same tool:
Related tools
Other tools you might find useful:
Ready to get started?
Open JSON to CSV to review its free limits and processing method.
Open JSON to CSV →Free tier · No account needed · Transparent limits