JSON to CSV converter (and back)
Paste an array of JSON objects to get a CSV you can open in a spreadsheet, or switch direction and turn CSV into JSON. Nested objects, arrays and missing keys are handled, and the rules are listed below.
How to use it
For JSON to CSV, paste an array of objects: [{...}, {...}]. That is the shape most
APIs and database exports produce. If the array is wrapped in an object, as in
{"data": [...]}, the first property holding an array of objects is used. A single
object becomes one row. For CSV to JSON, switch direction and paste CSV with a header row; each row
becomes an object keyed by the column names. Either way, the output updates as you type.
The conversion rules
JSON to CSV
- Columns are the union of every key in every record, in the order they are first seen.
- Nested objects are flattened into dotted paths:
address.city,address.postcode. - Arrays are written as JSON text, or joined with
;if you choose and they hold only plain values. - Null and missing values become empty cells. true and false are written as words.
- Quoting follows RFC 4180: a cell is quoted only if it contains the delimiter, a quote, a line break or leading or trailing spaces, and quotes inside are doubled.
CSV to JSON
- Numbers become JSON numbers only if converting back gives the same text, so
02134and 20-digit IDs stay strings. - true, false and null (lower case) become their JSON types; an empty cell becomes
null. - Dotted headers such as
user.namerebuild nested objects when that option is ticked. - With "Convert numbers" unticked, every value stays a string, exactly as it appeared in the CSV.
Worked example
The sample has three records. The union of their keys gives seven columns: id,
name, email, address.city, address.postcode,
tags and active. Ben has no email, so his email cell is empty. His
tags array is empty and is written as []. Chloé's name contains a comma, so it
is wrapped in quotes: "Chloé Martin, Jr.". The accented é passes through unchanged, because
everything is handled as Unicode text.
Copy that CSV, switch direction and paste it back, and you get the three records again, with
address rebuilt as a nested object and id as a number. Two things do not come
back identically. The tags come back as the string ["admin","beta"] rather than an array,
because a CSV cell cannot say it holds JSON. Ben's missing email comes back as null, because
CSV has no way to tell "missing" from "empty".
Limits
Deeply nested data with arrays of objects, such as an order with many line items, does not fit a flat grid well. The line items stay as JSON text in one cell rather than being spread over several rows. For that shape, convert the inner array on its own. JSON must be strictly valid: no comments, no trailing commas and no single quotes. The error message shows where the parser gave up, which is usually at or just after the first problem. Very large files, tens of megabytes, work but can make the browser tab slow while the text box redraws.
Once the data is in CSV, the table converter can turn it into Markdown or HTML, and the pivot table can summarise it.
Common questions
How are nested objects turned into columns?
Each nested key becomes a column named with the path to it, joined by dots. {"address": {"city": "Leeds"}} becomes a column called address.city. Going the other way, tick "Rebuild nested objects" and a column called address.city becomes a city key inside an address object again.
What happens to arrays?
By default an array is written into its cell as JSON text, such as ["admin","beta"], which keeps the structure and can be converted back exactly. If you only need something readable in a spreadsheet, choose "Join with semicolons" and a list of plain values becomes admin; beta. Arrays of objects are always kept as JSON text.
Why did some records get empty cells?
Records in a JSON array do not have to share the same keys. The CSV has one column for every key that appears in any record, in the order first seen, and a record that lacks a key gets an empty cell there. Null values are also written as empty cells.
Why did my ZIP code or ID stay as text when converting CSV to JSON?
Deliberately. A value is only turned into a JSON number if it survives the round trip unchanged. 02134 would become 2134 and lose its leading zero, and very long IDs lose digits beyond about 15 significant figures, so both stay strings. Plain numbers like 42 or -1.5 become numbers, and true, false and null become their JSON types.
Will Excel open the CSV correctly?
The download is UTF-8 with standard quoting, which current Excel opens correctly by double-click in most setups. If accented characters look garbled, use Data > From Text/CSV and choose UTF-8. In regions where Excel expects semicolons, choose the semicolon delimiter before downloading.
Other tools
- CSV cleaner How do I clean up this messy CSV export?
- CSV to bar or line chart How do I turn this spreadsheet into a chart quickly?
- Pie and donut chart maker What share of the total is each category?
- Histogram maker How many bins should my histogram have?
- Scatter plot with linear regression Are these two numbers related, and how strongly?
- Summary statistics calculator What are the mean, median and outliers of this data?
- Pivot table and group-by summarizer What are total sales by region and product?
- CSV to Markdown and HTML table converter How do I put this spreadsheet in a README or web page?