paste in · csv out · python below

JSON to CSV in Python — the code that does it

Convert your JSON to CSV in the browser, then take the Python that does exactly the same thing on your own machine.

Converter — Ready
Awaiting input
idle — paste JSON and the rows show up here
0 rows 0 columns Tab delimiter
runs entirely in your browser
nothing is uploaded, ever
no sign-up, no account
free — no paid tier, ever
Do it in code

The Python for JSON to CSV

You do not need pandas for this. The standard library already has everything a spreadsheet expects: csv.DictWriter writes the header row, quotes values that contain a comma, a quote or a newline, and lets each object become one row.

import csv
import json

with open("users.json", encoding="utf-8") as f:
    rows = json.load(f)

# A JSON array of objects becomes one CSV row per object.
if isinstance(rows, dict):
    rows = [rows]

fieldnames = list(dict.fromkeys(k for row in rows for k in row))

with open("users.csv", "w", newline="", encoding="utf-8") as f:
    writer = csv.DictWriter(f, fieldnames=fieldnames, restval="")
    writer.writeheader()
    writer.writerows(rows)

users.json becomes users.csv, using only the Python standard library

Two details are worth copying every time. newline="" on the output file stops Windows writing a blank line between rows, and DictWriter writes the header for you, so the column order always matches the JSON.

If your JSON contains nested objects, this snippet will not flatten them. Either use the nested objects version or pick the Flatten strategy in the converter above, which does the same flattening with a __ separator.

Worked example

A worked example

Two flat objects in, a two-row spreadsheet out. Nothing is hidden and nothing is guessed.

users.json

[
  {"id": 1, "name": "Ada Lovelace", "role": "Engineer"},
  {"id": 2, "name": "Grace Hopper", "role": "Admiral"}
]

users.csv

id,name,role
1,Ada Lovelace,Engineer
2,Grace Hopper,Admiral

The keys of the first object become the header row, and each object becomes one row in the same order. The converter above defaults to a tab delimiter so the file pastes straight into Excel - switch it to comma in the settings to match this example. The converter above produces this exact output from the same input, so you can check the code against the tool.

Step by step

Do it in the browser instead

No install, no virtualenv, no dependency to pin. The converter at the top of this page does the conversion locally in your browser.

  1. Paste your JSON

    Drop it into the box above, or drop a .json file onto it. Nothing is sent anywhere - the parsing runs on your own machine.

  2. Pick a delimiter

    Tab is the default because it pastes cleanly into Excel. Switch to comma for a standard .csv file.

  3. Choose how nested data is handled

    Header/detail keeps one row per object, Flatten joins nested keys with __, Concatenate joins arrays with a pipe, and Matrix expands every combination.

  4. Download the CSV

    The preview updates as you type. Download writes a file with the right extension, or use it in a paste straight into a spreadsheet.

Why HopConvert

Why use this instead of a script

The code is here when you need it. The tool is here when you just need the file.

Nothing is uploaded

The JSON is parsed in your browser. There is no server that could see your API keys, customer records or private payloads.

No install, no wait

No pip install, no virtualenv, no pandas build. The page is already open and already has the converter in it.

Correct quoting

Values containing commas, quotes or newlines are escaped exactly the way RFC 4180 requires, so Excel does not split a row in half.

Preview before you download

See the exact rows and columns first, switch delimiter or strategy, and only then take the file.

The complete guide

The full JSON to CSV guide

The guide goes deeper on flattening, delimiters, encoding and the edge cases that break naive converters.

Read the JSON to CSV guide

Related tools: CSV to JSON converter · JSON to Excel · JSON to CSV nested objects · JSONL to CSV

FAQ

Frequently asked questions

Short answers to the questions that come up most when converting JSON to CSV with Python.

What is the best Python library for converting JSON to CSV?
The standard library csv module. It is always installed, it writes RFC 4180 quoting correctly, and it handles a million-row file without loading a second copy into memory. pandas is convenient when you already use it for analysis, but it is a 40 MB dependency for what is a ten-line task.
How do I convert nested JSON to CSV in Python?
Flatten it first. Replace each nested object with a single key that joins the parent and child names - address.city becomes address__city - and join arrays of primitives with a delimiter. The nested objects tool page has a ready-made flatten function you can copy.
Do I need pandas to convert JSON to CSV?
No. csv.DictWriter plus json.load is enough for almost every case, and it is already on every Python install. Reach for pandas only when you also want to pivot, aggregate or join frames.
Why is my CSV full of blank lines in Excel?
You opened the file in text mode. Open it with newline="" and let the csv module handle line endings - it writes the correct \r\n for Excel without doubling them.
How do I keep leading zeros, like a zip code 01234?
Keep the column as a string. CSV has no types, so the fix is in whatever reads it back: in Excel use Data > Text to import the column as text, and in Python cast the value before writing it. The CSV to JSON type inference page explains how each side decides what is a number.

Convert your JSON right now

Free, instant, and private — your JSON never leaves this tab.

Convert to CSV Read the FAQ