Flatten Nested JSON for Spreadsheets and CSV
August 26, 2026 · Updated October 15, 2026 · RividTech Experts Team
API responses and app exports often look like nested JSON: a user object with an address inside, an order with a list of line items, metadata bags with uneven keys. Spreadsheets want the opposite - a rectangular table with one header row and consistent columns. Paste nested JSON into Excel and you get a mess; convert naively and nested fields disappear or turn into useless [object Object] strings.
Flattening is the bridge. This guide explains what flattening does, when to use it, and how to go from nested JSON to CSV or Excel using RividTech tools that run entirely in your browser.
What “flatten” means
Flattening turns nested paths into column names (or repeated rows) so every value sits in a cell. A field like customer.address.city might become a column named customer.address.city or customer_address_city . Arrays are the harder part: a list of tags might become multiple columns, a JSON string in one cell, or multiple rows - depending on the strategy and the tool.
The goal is not to preserve every nuance of the JSON document model. The goal is a table a human or a CSV importer can use.
When you should flatten
-
Exploratory analysis in Sheets or Excel on API data.
-
Sharing with non-developers who will not read raw JSON.
-
Bulk import into systems that only accept CSV.
-
Quick diffs of structured exports as tabular snapshots.
Skip flattening when the next consumer is another API or a document store that understands nested JSON - keep the structure and use a JSON-aware editor for readability.
A practical workflow
-
Validate and inspect. Check syntax in a JSON-aware editor, then use JSON Preview to inspect tabular data.
-
Flatten. Run Flatten JSON. It outputs CSV directly, with nested fields as dotted columns such as
customer.address.city. Arrays of simple values are joined into one cell (admin, beta); arrays of objects are kept as JSON text in one cell, so nothing is lost. -
Export a table. Use the CSV as is for pipelines, or turn it into a workbook with CSV to Excel for human review. If you only need top-level fields, JSON to CSV skips flattening and keeps nested values as JSON text.
-
Clean if needed. After you have CSV, use Column Tools , Remove Duplicates , or Find & Replace the same way you would on any other export.
Nested objects vs arrays
Nested objects (one address per customer) usually flatten cleanly into dotted or underscored column names. Each parent record stays one row; depth becomes width.
Arrays (many line items per order) force a choice:
-
One row per parent - array values packed into a single cell or several fixed columns. Simple, but hard to aggregate.
-
One row per child - explode the array so each item is its own row, repeating parent fields. Better for analysis; more rows.
Know which shape your spreadsheet or importer expects before you settle on an approach. If the first flatten pass is too wide or too sparse, trim columns after export rather than hand-editing thousands of cells.
Common pitfalls
-
Inconsistent keys across records. Optional nested fields create sparse columns. That is normal - empty cells mean “not present.”
-
Very deep nesting. Extremely deep paths make ugly headers. Consider trimming the JSON to the subtree you care about first.
-
Mixed types in one field. Sometimes a value is a string, sometimes an object. Flattening may coerce or drop structure; inspect samples first.
-
Huge payloads. Browser memory is finite. Work on a sample, or split upstream, before flattening multi‑megabyte dumps.
Going the other way
Flat CSV back to JSON is the reverse problem. CSV to JSON produces an array of objects with one level of keys. If your columns use dotted names, the Nest mode of Flatten JSON rebuilds the nested objects and parses cells that hold JSON arrays or objects. What it cannot recover are types (every value comes back as a string) and arrays that were joined with commas. Rebuilding a rich domain model with real types still needs application code or a deliberate schema.
Getting started
Check your payload in a JSON-aware editor, flatten with Flatten JSON , then download the CSV or turn it into a workbook with CSV to Excel . From there you can preview, clean, or share a normal table - without ever sending the document to a server.