Free tool

JSON to CSV converter

Paste a JSON array or drop a .json file and get CSV as you type. Each object becomes a row, each key a column, and nested objects become columns like address.city. Choose the delimiter and the columns, check the table preview, then copy or download the CSV.

Free · no sign-up · runs in your browser, nothing is uploaded

JSON
Drop a .json or .ndjson file, or click to choose one

CSV appears here as you type.

Nested data

Arrays:

CSV format

How JSON becomes CSV

CSV is a flat grid, and JSON is a tree, so a converter has to make a few choices. These are the ones this tool makes, and the options that change them:

JSONCSVOption
{"id": 1, "name": "Ada"}One row; columns id, name-
{"address": {"city": "Lisbon"}}address.cityFlatten nested objects
{"tags": ["a", "b"]}["a","b"], a; b or tags.0, tags.1Arrays
nullEmpty cellWrite null as the word null
A key only some objects haveIts own column, empty where missing-
{"data": [ ... ]}The rows of dataArray to convert
One object per line (NDJSON)One row per line-

Values are written the way RFC 4180 describes CSV: a field that contains the delimiter, a double quote or a line break is wrapped in double quotes, and a quote inside it is written twice ("Chen ""CJ"" Jun"). Lines end with CRLF by default, as the RFC specifies; switch it off for LF if a Unix tool will read the file.

Opening the CSV in Excel or Google Sheets

  • Accents and emoji look broken. Excel guesses the encoding of a CSV file. The download starts with a UTF-8 byte order mark (BOM), which tells Excel the file is UTF-8. Google Sheets reads UTF-8 either way.
  • Everything lands in one column. Excel splits on the list separator of your regional settings, which is a semicolon in many European locales. Pick Semicolon, or import the file with Data, From Text/CSV and choose the delimiter there.
  • Leading zeros disappear. Excel turns 02134 into the number 2134 when it opens a CSV. The CSV still holds the zeros; import the column as Text to keep them.
  • Data from users can run as a formula. A cell that starts with =, +, - or @ may be treated as a formula, which OWASP calls CSV injection. The "Protect against formula injection" option prefixes such cells with a single quote, as OWASP suggests. OWASP also notes that Excel can drop that protection after the file is saved and opened again, so treat exported user data with care.

Convert JSON to CSV in JavaScript, Python or jq

JavaScript, no library, for an array of flat objects. Nested values are written as JSON text:

// rows: an array of flat objects
const cols = [...new Set(rows.flatMap(Object.keys))];
const cell = v => {
  const s = v == null ? '' : typeof v === 'object' ? JSON.stringify(v) : String(v);
  return /[",\r\n]/.test(s) ? '"' + s.replace(/"/g, '""') + '"' : s;
};
const csv = [cols, ...rows.map(r => cols.map(c => r[c]))]
  .map(r => r.map(cell).join(','))
  .join('\r\n');

Python with the standard library. Open the file with newline="", as the csv module docs say, or you get blank lines between rows on Windows:

import csv, json

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

cols = list(dict.fromkeys(k for r in rows for k in r))
with open("users.csv", "w", newline="", encoding="utf-8") as f:
    w = csv.DictWriter(f, fieldnames=cols)
    w.writeheader()
    w.writerows(rows)

pandas flattens nested objects with json_normalize, using a dot as the separator by default:

import json
import pandas as pd

data = json.load(open("users.json", encoding="utf-8"))
df = pd.json_normalize(data)          # {"address": {"city": ..}} -> address.city
df.to_csv("users.csv", index=False)

jq on the command line. @csv takes an array and writes it as one CSV line, with strings in double quotes:

# One row per object, with a header row; @csv quotes strings and doubles quotes
jq -r '(.[0] | keys_unsorted) as $k | $k, (.[] | [.[$k[]]]) | @csv' users.json > users.csv

Things that go wrong

  • Invalid JSON. Single quotes, trailing commas, comments and unquoted keys are not JSON. The error shows the line and column. To fix and pretty-print the JSON first, use the JSON formatter.
  • Very large integers. JSON itself has no size limit, but RFC 8259 notes that numbers are only portable within the range of IEEE 754 doubles. JavaScript, and this tool, read integers above 9,007,199,254,740,991 approximately. Keep long IDs as strings in the JSON.
  • Deeply nested arrays of objects. An order with ten line items is really two tables. Paste the inner array on its own to get one row per item, or use Column per item to keep one row per order.

Going the other way? Use CSV to JSON, or open a CSV file as a table with the CSV viewer. Looking for data to convert? Browse free public APIs.

FAQ

How do I convert JSON to CSV?+

Paste the JSON or drop a .json file into the box above. Each object in the array becomes a row and each key becomes a column; the CSV appears as you type, and you can copy it or download a .csv file. In code, collect the keys of all objects as the header, then write one line per object, quoting any value that contains a comma, a double quote or a line break.

How are nested JSON objects converted?+

They are flattened into columns named with dot paths: {"address": {"city": "Lisbon"}} becomes a column address.city. Arrays can be kept as JSON text in one cell, joined into one cell (a; b), or spread into one column per item (tags.0, tags.1). You can also switch flattening off to keep each nested object as JSON text.

Can I convert an API response where the array is inside an object?+

Yes. If the JSON is an object such as {"data": {"items": [...]}}, the tool finds the arrays of objects inside it and converts the largest one. When there are several, a menu lets you pick which one to convert.

What happens when objects have different keys?+

The columns are the union of all keys, in the order they first appear. A row that lacks a key gets an empty cell in that column, so no data is dropped.

Why does Excel show strange characters or put everything in one column?+

Strange characters (é instead of é) mean Excel did not read the file as UTF-8; the download adds a UTF-8 byte order mark so it does. One column means Excel expected a different separator: in many European locales Excel splits on semicolons, so choose Semicolon as the delimiter.

How do I convert a JSON file to CSV in Excel?+

In Excel for Microsoft 365 or Excel 2016 and later, use Power Query: Data, Get Data, From File, From JSON. Convert the list to a table, expand the record columns, choose Close & Load, then save the sheet as CSV. For a quick one-off, converting here and opening the .csv in Excel is faster.

Is my JSON uploaded anywhere?+

No. Parsing and conversion run in your browser with JavaScript. Nothing is sent to DevHunt or anyone else, so it is safe for private data. Small inputs are kept in the page URL so you can share a result; large ones are not.

Can it convert JSON Lines (NDJSON)?+

Yes. If the input is one JSON object per line, as in .jsonl or .ndjson files and many log exports, each line becomes one row.

Sources: RFC 4180 (CSV) · RFC 8259 (JSON) · OWASP: CSV injection · Python csv module · pandas.json_normalize · jq manual (@csv) · JSON Lines · Microsoft: import data with Power Query. Checked 2026-10-29.