How to Convert JSON to CSV: 5 Methods

Sooner or later, everyone who works with data needs to know how to convert JSON to CSV: an API hands you JSON, but your spreadsheet, your colleague, or your import tool wants CSV. The conversion sounds trivial — until nested objects, arrays, and commas inside values show up. This guide covers all five practical methods, from no-code to command line, explains the nested-JSON problem properly, and states the honest size limits each method hits.

Quick orientation if you are new: JSON is great for programs (nested, typed), CSV is great for spreadsheets (flat, simple). Converting means flattening — and flattening always involves decisions. Our free JSON to CSV converter handles the common case in your browser with no signup; the methods below cover everything else.

Table of Contents

Method 1: How to Convert JSON to CSV Online (Fastest, No Code)

For the overwhelmingly common case — a JSON array of flat objects, up to a few megabytes — an online converter is the fastest way to convert JSON to CSV. Paste the JSON, get CSV back, open it in Excel. Our JSON to CSV converter runs entirely in your browser, which matters for privacy: your data never travels to a server, unlike upload-based converters.

What “flat” means: every object has the same simple keys, no nesting. Like this:

[{"name":"Ayesha","city":"Lahore","orders":12},{"name":"Bilal","city":"Karachi","orders":7}]

That converts cleanly to:

name,city,orders
Ayesha,Lahore,12
Bilal,Karachi,7

The header row comes from the object keys; each object becomes one row. If your JSON looks like this, stop here — you are done in ten seconds. The remaining methods exist for the cases that are not this clean.

Method 2: Excel / Power Query

If you want to know how to convert JSON to CSV without leaving your spreadsheet, Excel can import JSON directly — no converter website needed. In modern Excel: Data → Get Data → From File → From JSON. Power Query opens, shows the parsed structure, and lets you expand nested records and lists by clicking the little arrows on column headers. Then Close & Load drops it into a worksheet, and you save as CSV.

This method shines when the JSON is nested, because Power Query’s “expand” UI walks you through flattening interactively — you see each level become columns. The honest downsides: the clicks are fiddly to describe and easy to get wrong (expanding a list column duplicates rows in ways that surprise beginners), and Excel caps out at 1,048,576 rows — a hard wall no setting changes. JSON arrays longer than that get silently truncated on import, which is a nasty way to lose data.

Method 3: Google Sheets

Google Sheets has no native JSON import, which surprises people. The standard workaround is IMPORTDATA — but that only handles URLs serving CSV, not JSON. For JSON you have three options: paste through an online converter first (method 1), use an add-on (several exist; they require granting a third party access to your spreadsheets — weigh that), or use Apps Script with UrlFetchApp + JSON.parse for recurring imports.

For a one-off conversion, learning how to convert JSON to CSV inside Sheets is not worth the trouble — method 1 plus paste is genuinely faster than fighting Sheets’ limitations. For a JSON feed you need refreshed weekly, the 20-line Apps Script is worth writing once. Sheets also has a soft practical limit around 10 million cells — generous, but a wide flattened JSON can hit it sooner than you expect.

Method 4: Python (pandas)

When the file is big, the structure is messy, or the conversion runs on a schedule, code wins. Learning how to convert JSON to CSV in Python pays for itself quickly if you do this more than once. The pandas two-liner handles flat JSON arrays:

import pandas as pd
pd.read_json("data.json").to_csv("data.csv", index=False)

For nested JSON, pd.json_normalize() is the workhorse — it flattens nested objects into dot-notated columns automatically (more on the dot notation below):

import pandas as pd, json
data = json.load(open("data.json"))
pd.json_normalize(data).to_csv("data.csv", index=False)

Python’s real advantage is control: you can rename columns, drop fields, handle encoding issues, and process files too large for memory in chunks. The honest cost is setup — installing Python and pandas is a real barrier if you have never done it, and for a one-off 50 KB file it is overkill. Match the method to the job.

Method 5: Command Line (jq + Miller)

For terminal users who already live in the shell, how to convert JSON to CSV is a two-command affair: jq plus mlr (Miller) converts JSON to CSV without leaving the shell. Given a file of flat objects:

jq -r '.[] | [.name, .city, .orders] | @csv' data.json > data.csv

The @csv formatter handles quoting correctly — this matters, because hand-rolling CSV with string concatenation breaks on commas and quotes (see pitfalls below). Miller goes further and can flatten nested JSON directly:

mlr --j2c --jflatsep . cat data.json > data.csv

CLI methods are the best choice for huge files and automation: they stream, they script, and they run anywhere. They are the worst choice if the command line is unfamiliar — the learning curve is real, and a typo can silently produce wrong output. Verify the first few rows every time.

The Nested JSON Problem, Explained Simply

Here is the thing most “how to convert JSON to CSV” guides gloss over: CSV has no nesting. A spreadsheet is rows and columns — two dimensions. JSON can nest arbitrarily deep. So converting nested JSON to CSV requires deciding how to squash the extra dimensions, and different tools decide differently.

The standard approach is dot notation: nested keys become column names joined by dots. Given:

{"name":"Ayesha","address":{"city":"Lahore","zip":"54000"},"tags":["vip","wholesale"]}

A flattener produces columns: name, address.city, address.zip, tags — with the array either joined into one cell (vip;wholesale) or exploded into multiple rows (one per tag, duplicating the other columns). Both are “correct”; they answer different questions. pd.json_normalize uses dot notation by default. Our online converter flattens one level with dot notation and joins arrays with a separator you can see before downloading.

The trap: two tools can convert the “same” nested JSON to CSV and produce different-looking files — different column names, different row counts — and both are defensible. Always inspect the output’s shape before feeding it downstream. If your JSON is deeply nested (three-plus levels) or arrays contain objects containing arrays, consider whether CSV is even the right target — sometimes the honest answer is “keep it as JSON” or load it into a real database.

Honest Limits: What Each Method Chokes On

No guide should pretend every method handles every file. Here are the real ceilings:

  • Browser-based converters: typically comfortable to ~10–50 MB of JSON; beyond that the tab slows, freezes, or crashes — the browser was not designed as a data pipeline. Also: never paste credentials, tokens, or personal data into a converter that uploads to a server. Ours processes locally, but most do not.
  • Excel: 1,048,576 rows hard cap; Power Query can also get sluggish past a few hundred thousand rows on modest hardware.
  • Google Sheets: ~10 million cells practical limit; add-ons add a trust/permission question.
  • Python/pandas: limited by RAM — read_json loads everything into memory. For files bigger than memory, process in chunks or use a streaming parser.
  • CLI (jq/mlr): streams well and handles the largest files, but jq slurps the whole input by default — use --stream for truly huge files.

Rule of thumb: under 5 MB, use whatever is fastest (usually the browser). 5–500 MB, use Python or CLI. Over 500 MB, you are in streaming territory — CLI with streaming flags, or reconsider whether CSV is the right format at all.

CSV Pitfalls Nobody Warns You About

Three CSV gotchas corrupt more conversions than any other cause:

  • Commas and quotes inside values. A value like Say "hi", ok? must be wrapped in quotes with internal quotes doubled: "Say ""hi"", ok?". Proper converters (including @csv in jq and pandas’ to_csv) do this automatically. Hand-built CSV almost never does — never build CSV with string concatenation.
  • Excel eats leading zeros and mangles long numbers. ZIP codes like 05400 become 5400; 16-digit card-like numbers become scientific notation. If your JSON has string fields that look numeric, verify them after opening in Excel — the CSV is fine, Excel’s interpretation is the problem.
  • Encoding. Non-English text (Urdu names, for example) needs UTF-8. Excel on Windows defaults to expecting UTF-8 with BOM for CSVs; a BOM-less UTF-8 file opens as mojibake. When in doubt, open via Data → From Text/CSV and set the encoding explicitly instead of double-clicking.

A quick sanity habit: after any conversion, check the row count (JSON array length vs. CSV data rows) and eyeball the first and last five rows. Most conversion errors announce themselves immediately if you look.

Try It: JSON to CSV Converter

For the common case — flat or lightly nested JSON under a few megabytes — the fastest way to convert JSON to CSV is our free JSON to CSV converter: paste, preview the flattened columns, download. It runs in your browser so your data never leaves your device, and it handles the dot-notation flattening and array joining described above. If you only memorize one answer to how to convert JSON to CSV, make it this workflow: paste, preview the columns, download. If your JSON is malformed to begin with, run it through our JSON formatter first, and clean stray whitespace or wrapping text with the text cleaner. The format itself is documented on Wikipedia’s CSV page.

Frequently Asked Questions

How do I convert JSON to CSV in Excel?

Use Data, then Get Data, then From File, then From JSON. Power Query opens the parsed JSON; expand nested columns with the arrow icons, then Close and Load into a worksheet and save as CSV. Note Excel’s hard cap of 1,048,576 rows — longer JSON arrays get truncated.

Can I convert JSON to CSV without coding?

Yes. Paste the JSON into a browser-based converter like our free JSON to CSV converter and download the result — no code, no install. This handles flat JSON arrays and lightly nested objects. For deeply nested or huge files, Excel’s Power Query or Python are better choices.

How to convert nested JSON to CSV?

The principle behind how to convert JSON to CSV does not change with nesting — flatten first, then export. Flatten it with dot notation: nested keys become column names like address.city, and arrays are either joined into one cell or exploded into multiple rows. Tools like pandas json_normalize, Miller (–jflatsep), and Power Query’s expand buttons do this; always inspect the output shape because different tools make different flattening choices.

Why does my CSV look wrong in Excel?

Usually one of three things: commas or quotes inside values were not escaped (use a proper converter, never string concatenation), Excel stripped leading zeros or converted long numbers to scientific notation (a display issue — the CSV is fine), or the file encoding is not UTF-8 with BOM (import via Data, From Text/CSV and set UTF-8 explicitly).