DEV Community

Tidy Byte Tools
Tidy Byte Tools

Posted on Originally published at tidybytetools.github.io

How to convert nested JSON or JSON Lines into a flat CSV

You have a JSON file with nested objects and lists. Spreadsheets want flat rows and columns. This page shows how to flatten that JSON into CSV, starting with free options.

What "flatten" means

Nested JSON looks like this:

{"user":{"name":"Ada","city":"London"},"tags":["math","code"]}
Enter fullscreen mode Exit fullscreen mode

A flat row might look like:

user.name user.city tags
Ada London math; code

Keys become column names with dots. Lists are joined or expanded, depending on the tool. There is more than one honest way to flatten lists, so check a few sample rows before you trust a big file.

Free options first

A spreadsheet, if the JSON is small. Some tools (and many coding notebooks) can open JSON and export CSV. For a tiny file this is fine.

Python on your computer. If you already use Python, you can load the JSON and write CSV with the standard library. For one-off work, that is free and keeps the file on your machine.

json-shaper-lite (related, free). json-shaper-lite turns notes, CSV, TSV, and Markdown tables into typed JSON. It is the reverse direction. Use it when you are starting from a table, not when you already have nested JSON.

If a free local script already gives you clean rows, you are done.

Cloud option: JSON to CSV Flattener

JSON to CSV Flattener runs on Apify. You give it JSON or JSON Lines (one JSON object per line). It writes flat rows you can export as CSV.

What it does

  • Flattens nested objects with dotted keys.
  • Accepts JSON and JSON Lines.
  • Charges per output row at a low price.

What it does not do

  • It will not invent a perfect schema for every weird list shape. Check the first rows.
  • Links must be public if you pass file URLs. Password-protected files will not open.
  • It is not a full ETL suite. It does one job: flatten to rows.

Price (November 2026): $0.0001 per row written. Failed files are free. Apify also adds a small start fee per run.

  1. Open the Actor page.
  2. Paste JSON or give a file link (a sample is often filled in).
  3. Click Start.
  4. Export the dataset as CSV, or download the CSV from the run storage.

Going the other way (CSV or Excel to JSON)

If you need Excel or CSV to JSON instead, use a free local script (or pandas / a spreadsheet add-on). Do not use the flattener for that direction. We have a separate Excel-and-CSV-to-JSON Actor in the publish queue; this page will link it only after it is public on the Store.

A short way to choose

Your situation What to use
Tiny JSON, you already write Python Free local script
You have a table and need JSON Free json-shaper-lite
Nested JSON or JSON Lines, want CSV in the cloud Apify JSON to CSV Flattener

Related guides

These tools are made by Tidy Byte Tools.


Originally published at https://tidybytetools.github.io/guides/flatten-nested-json-into-csv/. Tools by Tidy Byte Tools.

Top comments (0)