Skip to content

Flatten JSON to a Table

Turn nested JSON, like an API response, into flat rows and columns you can open in Excel or Google Sheets.

Runs in your browser. Your file is never uploaded.

Or paste JSON

What it does

Nested objects are spread into their own columns, named by their path, so the data opens cleanly in Excel or Google Sheets.

customers.json
[{
  "id": 1,
  "name": "Asha Rao",
  "address": { "city": "Pune", "country": "IN" },
  "tags": ["retail", "repeat"]
}, ...]
customers.csv
idnameaddress.cityaddress.countrytags
1Asha RaoPuneINretail, repeat
2Daniel KimSeoulKRwholesale

How to flatten JSON

  1. Drop a .json file above, or paste the JSON text.
  2. Choose how lists should be handled (see below).
  3. Check the preview and download it as CSV or Excel.

Choosing how to handle lists

Take this record:

{"order": 7, "items": [{"sku": "A1"}, {"sku": "B2"}]}
OptionResultUse it when
Join into one cell1 row, items.sku = A1, B2You just want to read the data
One column per item1 row, items.1.sku, items.2.skuLists are short and similar in length
One row per item2 rows, each with order = 7You'll total, filter or pivot the items

Doing it in Python

If you work in pandas, json_normalize does the same job:

import pandas as pd, json
data = json.load(open("orders.json"))
df = pd.json_normalize(data, record_path="items", meta=["order"])
df.to_csv("orders.csv", index=False)

record_path is the "one row per item" option. Leave it out to get one row per record.

Questions

What does “flatten” mean?

Nested values get their own columns. {"address": {"city": "Pune"}} becomes a column called address.city with the value Pune, so the data fits in a normal table.

How large a JSON file can I flatten?

Files over 20 MB are handled by DuckDB, a database engine that runs in this page and reads the file from your disk in pieces, so files of 1 GB and more work on a normal laptop. The first time, your browser downloads the engine (about 30 MB) and then caches it. Large files are flattened in batches and written straight to the download, so the result can have millions of rows.

How are lists (arrays) handled?

You choose. “Join into one cell” writes ["a","b"] as a, b. “One column per item” makes tags.1, tags.2 and so on. “One row per item” repeats the parent row for every item, which is what you want for things like orders with line items.

My JSON is an object, not a list. Will it work?

Yes. If the top level is an object, the tool looks for the first list inside it, such as "data" or "results", which is how most APIs return records. A single object becomes a one-row table.

Can I get an Excel file instead of CSV?

Yes, use “Download .xlsx”. The file is created in your browser.

Is there a size limit?

Only your computer’s memory. Files of tens of megabytes are fine in a desktop browser.