MergeJSON

How to Convert JSON to CSV: A Practical Guide (Nested Data, Delimiters & Excel)

Learn how to convert JSON to CSV the right way — flatten nested objects, handle arrays, pick a delimiter, and open the result in Excel. Online, in Python, and with jq.

Published June 14, 2026

CSV is the universal language of spreadsheets and data tools, but most data is born as JSON — from APIs, config files, and exports. Converting between the two sounds trivial until you hit a nested object or an array inside a record. This guide covers how to convert JSON to CSV cleanly: online in one click, in Python, and from the command line, with a clear plan for the parts that usually break.

The quickest way: convert JSON to CSV online

For a one-off conversion, nothing beats a browser tool. Copy your JSON, paste it into the JSON to CSV converter, and press Convert to CSV. You get a downloadable .csv immediately, with the header row built from your object keys.

Look for a converter that runs client-side (ours does) so your data is never uploaded — important for API responses, customer exports, and anything private. It also means there is no file-size cap: many online converters reject files larger than about 10 MB because they process them on a server, but a local tool is limited only by your machine’s memory.

Use it when: you want a fast, private conversion on any device with no install.

Understand the shape: JSON array of objects → rows

CSV is a flat grid of rows and columns, so the JSON that converts most naturally is an array of objects, where each object becomes a row and each key becomes a column:

[
  { "id": 1, "name": "Ada", "city": "London" },
  { "id": 2, "name": "Alan", "city": "Manchester" }
]

This becomes:

id,name,city
1,Ada,London
2,Alan,Manchester

A single object converts to a one-row CSV. If your JSON is wrapped — for example { "data": [ ... ] } — point the converter at the array, or grab the inner array first.

The hard part: nested objects and arrays

Flat data is easy. The reason JSON-to-CSV conversions go wrong is nesting. There are two cases to plan for.

Nested objects → dot-notation columns

When a value is itself an object, flatten it into separate columns using dot notation:

{ "name": "Ada", "address": { "city": "London", "zip": "EC1" } }

becomes columns name, address.city, address.zip. This keeps every field while staying flat. Our converter does this by default; you can turn flattening off to keep the object as a JSON string in one cell instead.

Nested arrays → pick a strategy

An array inside a record (say, a user’s roles) has no single correct CSV representation, so you should choose one:

  • Expand to rows — emit one row per array item. A user with two roles produces two rows. Best for one-to-many data you will pivot or group later.
  • Join into one cell — combine items into a single cell, e.g. admin, editor. Best when you just need a readable summary.
  • Keep as JSON — write the raw array (["admin","editor"]) into the cell. Best when a downstream tool will parse it again.

Most converters silently pick one of these for you. Choosing deliberately is the difference between a tidy spreadsheet and a mess.

Delimiters, TSV, and opening in Excel

A “CSV” is not always comma-separated. A few practical tips:

  • Delimiter choice. Use a semicolon for many European locales (where Excel expects ;), a tab to produce a TSV, or a pipe (|) when your data contains commas.
  • Quoting. Any field containing the delimiter, a quote, or a line break must be wrapped in double quotes, with internal quotes doubled ("""). A good converter does this automatically following RFC 4180 — don’t hand-edit it.
  • Excel and accents. If names with accents look garbled in Excel, re-export with a UTF-8 BOM. That single marker tells Excel to read the file as UTF-8.

Convert JSON to CSV in Python

For repeatable conversions in a script, Python’s standard library is enough for flat data:

import json, csv

with open("data.json") as f:
    rows = json.load(f)            # a list of dicts

with open("data.csv", "w", newline="") as f:
    writer = csv.DictWriter(f, fieldnames=rows[0].keys())
    writer.writeheader()
    writer.writerows(rows)

For nested data, flatten first (e.g. with pandas.json_normalize):

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

json_normalize expands nested objects into dotted columns much like the online tool. You will still decide how to treat arrays.

Convert JSON to CSV with jq

In a terminal, jq handles array-of-objects cleanly:

jq -r '(.[0] | keys_unsorted) as $k
       | $k, (.[] | [.[$k[]]])
       | @csv' data.json

This prints the header from the first object’s keys, then one @csv-escaped row per object. It is powerful but fiddly for nested data — reach for it when you are already scripting in the shell.

Which method should you use?

For a quick, private, one-off conversion — especially with nested data or a large file — use the online JSON to CSV converter: paste, choose your array mode and delimiter, pick your columns, and download. Use Python when the conversion is part of a data pipeline, and jq when you are already in the terminal. Whatever you choose, decide up front how objects flatten and how arrays expand, and the rest is easy.

New to the format, or wrangling messy input first? Read what is JSON, fix broken files with the JSON validator, and explore structure with the JSON viewer.

Ready to merge your JSON?

Combine files or snippets in your browser — free and private.

Open the merge tool

Keep reading