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.
[{
"id": 1,
"name": "Asha Rao",
"address": { "city": "Pune", "country": "IN" },
"tags": ["retail", "repeat"]
}, ...] | id | name | address.city | address.country | tags |
|---|---|---|---|---|
| 1 | Asha Rao | Pune | IN | retail, repeat |
| 2 | Daniel Kim | Seoul | KR | wholesale |
How to flatten JSON
- Drop a
.jsonfile above, or paste the JSON text. - Choose how lists should be handled (see below).
- 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"}]} | Option | Result | Use it when |
|---|---|---|
| Join into one cell | 1 row, items.sku = A1, B2 | You just want to read the data |
| One column per item | 1 row, items.1.sku, items.2.sku | Lists are short and similar in length |
| One row per item | 2 rows, each with order = 7 | You'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.