APIs, exports from web apps and log pipelines speak JSON. Finance teams, analysts and most spreadsheets speak CSV. Sooner or later someone asks you to "just send it as a spreadsheet", and you discover that the JSON is not a neat table: customers have nested addresses, orders contain arrays of items, and some records have fields that others lack.
This guide explains how a converter turns a tree-shaped JSON document into flat rows and columns, what choices you have for nested objects and arrays, how to get the result into Excel or Google Sheets cleanly, and what to do when the data simply does not fit a single table.
Why JSON and CSV do not map one-to-one
CSV is a grid. Every row has the same columns, and every cell holds a single piece of text. JSON is a tree. A value can be a string, a number, a boolean, null, an object containing more values, or an array containing any number of them.
Converting between the two requires three decisions:
- What is a row? Usually each element of a top-level array becomes one row. A single object becomes a single row.
- What is a column? Each distinct key becomes a column. When records have different keys, the column list is the union of all of them, and missing values become empty cells.
- What happens to nesting? Nested objects and arrays have to be flattened into column names, or stored as text inside a cell.
Flattening with dot notation
The common approach is to join the path to each value with dots. Take this input:
[
{ "id": 1, "customer": { "name": "Acme Ltd", "city": "Leeds" },
"tags": ["wholesale", "priority"], "total": 1250.5 },
{ "id": 2, "customer": { "name": "Blue Harbor, Inc.", "city": "Boston" },
"tags": ["retail"], "total": 80 }
]
Flattened with array indexes, it becomes:
id,customer.name,customer.city,tags.0,tags.1,total
1,Acme Ltd,Leeds,wholesale,priority,1250.5
2,"Blue Harbor, Inc.",Boston,retail,,80
Notice three things. customer.name and customer.city came from the nested object. tags.0 and tags.1 came from the array, and the second record has an empty tags.1 because it only had one tag. And Blue Harbor, Inc. is wrapped in quotes because it contains the delimiter; CSV rules (RFC 4180) say any field containing the delimiter, a double quote or a line break must be quoted, with inner quotes doubled.
The alternative for arrays is to keep each array as a JSON string in one cell: "[""wholesale"",""priority""]". That keeps one column per array no matter how long it is, which is better when arrays vary a lot in length.
Convert JSON to CSV with our tool
The JSON to CSV Converter flattens and converts as you type, entirely in your browser.
- Open the JSON to CSV Converter. Paste your JSON into JSON input, or click Open file to load a
.jsonfile (up to 20 MB). Load sample shows a worked example. - Choose a Delimiter: Comma, Semicolon, Tab or Pipe. Choosing Tab downloads a
.tsvfile instead of.csv. - Choose how Nested arrays are handled: Index keys (tags.0) gives one column per array position; Keep as JSON text stores the whole array in one cell.
- Turn Header row off if the receiving system expects data rows only.
- Check the CSV output pane, then click Copy or Download.
The input must be a JSON object or an array of objects. If it is not valid JSON, the output pane shows the error with its line and column. Columns appear in the order keys are first seen, so put the most complete record first if column order matters. Rows are separated with CRLF line endings, which is what RFC 4180 specifies and what Excel expects.
If your JSON has an unexpected shape, look at it first in the JSON Viewer. When the rows you want are buried inside a wrapper, such as {"data": {"results": [...]}}, extract that inner array with the JSONPath Tester and convert just that.
Other ways to do it
Excel Power Query
Excel for Windows and Microsoft 365 can import JSON through Data → Get Data → From File → From JSON. Power Query lets you expand nested records and lists column by column. It is excellent for a repeatable import you refresh often, but it takes several clicks per nested field.
jq on the command line
If you have jq installed, you can choose the exact columns:
jq -r '.[] | [.id, .customer.name, .total] | @csv' orders.json
This is ideal in scripts and for very large files, but you need to list every column and write the header yourself.
Python
import json, pandas as pd
rows = json.load(open("orders.json", encoding="utf-8"))
pd.json_normalize(rows).to_csv("orders.csv", index=False)
json_normalize flattens nested objects with dots, much like the browser tool, and is the better choice when you also need to clean or reshape the data.
Getting the CSV into a spreadsheet cleanly
Pick the delimiter your Excel expects
In regions where the comma is the decimal separator, Excel often expects semicolons in CSV files. If double-clicking the file puts everything into column A, regenerate it with Semicolon, or import it through Data → From Text/CSV and choose the delimiter explicitly. Google Sheets detects the delimiter on import.
Accented letters look wrong
The file is UTF-8. Some versions of Excel assume a legacy encoding when you double-click a CSV. Import it with Data → From Text/CSV and select UTF-8 (code page 65001) as the file origin.
Leading zeros and long numbers disappear
Excel converts 02134 to 2134 and long IDs to scientific notation. The CSV is correct; the spreadsheet is reformatting it. Import the column as Text instead of opening the file directly.
When one table is not enough
Flattening works well when each record has a few nested objects and short arrays. It breaks down when a record contains a long list of child records, such as an order with fifty line items: you get items.0.sku through items.49.qty, hundreds of columns, and most cells empty.
In that case, produce two tables instead: one row per order, and a separate file with one row per line item that repeats the order ID. That is how relational databases store the data, and it is far easier to filter and total in a spreadsheet. If the data is heading into a database anyway, the CSV to SQL tool can turn each table into INSERT statements.
Frequently asked questions
Can every JSON file be converted to CSV?
Any array of objects or single object can be, but deeply nested data or long arrays produce very wide, sparse tables. For those, split the data into several related tables.
What happens to records with missing fields?
Their cells in that column are left empty. The column list is built from every key found in every record.
How do I convert the CSV back to JSON?
Use the CSV to JSON Converter. Flattened column names like customer.city come back as plain keys, not nested objects, so keep the original JSON if you need the exact structure.
Why is my JSON rejected?
The input must be valid JSON whose top level is an object or an array of objects. A bare number or string, or an empty array, cannot become rows. Fix syntax errors first; the error message shows the line and column.
Is my data uploaded anywhere?
No. The conversion runs in your browser, and the downloaded file is created on your device.