JSON & Data
How to Convert JSON to CSV for Excel and Google Sheets
Convert a JSON array of objects into clean CSV ready for Excel or Sheets. Learn how flattening works, how to handle nested fields, and pitfalls to avoid.
Try the toolJSON to CSV →You've pulled a clean JSON array from an API — users, orders, analytics rows — and now someone in ops wants it in a spreadsheet. JSON is perfect for programs and awkward for humans who live in Excel or Google Sheets. Converting to CSV bridges that gap: rows and columns anyone can sort, filter, and pivot.
How JSON maps to CSV
CSV (comma-separated values) is a flat, tabular format: one header row of column names, then one line per record with values separated by commas. JSON that converts cleanly is an array of objects where each object is a row and each key is a column:
[
{ "id": 1, "name": "Ada Lovelace", "role": "admin" },
{ "id": 2, "name": "Alan Turing", "role": "editor" },
{ "id": 3, "name": "Grace Hopper", "role": "admin" }
]
That becomes:
id,name,role
1,Ada Lovelace,admin
2,Alan Turing,editor
3,Grace Hopper,admin
The converter collects the union of all keys to build the header, then writes each object's values in that column order. Rows missing a key get an empty cell.
The rule that trips everyone up: quoting
CSV uses commas as delimiters, so what happens when a value contains a comma? It must be wrapped in double quotes. And a value containing a double quote escapes it by doubling. This is the part hand-rolled converters get wrong:
[
{ "name": "Wright, Orville", "note": "Said \"hello\"" }
]
// Correct CSV output:
name,note
"Wright, Orville","Said ""hello"""
Values with commas, double quotes, or newlines must be quoted, or the columns will shift and your spreadsheet will be garbage. A good converter handles this automatically.
A practical walkthrough
Paste your JSON array into the JSON to CSV tool. It runs in your browser, detects the columns from your objects, escapes tricky values, and gives you CSV you can paste straight into Excel or Google Sheets.
- Paste a JSON array of objects.
- Let the tool derive the header row from the keys.
- Copy or download the resulting CSV.
- Open it in your spreadsheet app, or paste and use “Split text to columns.”
Handling nested objects and arrays
CSV is flat; JSON is not. If an object contains a nested object or array, there's no single obvious column for it. Two common strategies:
- Flatten nested keys into dotted column names, e.g.
address.city. - Serialize the nested value back to a JSON string inside one cell.
If your data is deeply nested, consider reshaping it first so each record is flat — you'll get far cleaner columns.
Common pitfalls
- Not an array. A single object
{...}or a wrapper like{"data": [...]}needs to be reduced to the inner array first. - Inconsistent keys. Objects with different shapes produce sparse columns — expected, but check the empty cells are intentional.
- Excel and leading zeros. A value like
"00042"or a long numeric ID may be reformatted by Excel. Import as text if that matters. - Delimiter locale. Some regional Excel setups expect semicolons instead of commas — watch for everything landing in one column.
CSV has no formal spec everyone follows, but RFC 4180 is the closest thing. Quote fields with commas, quotes, or newlines, and you'll be compatible with almost everything.
Going the other direction
Need to reverse the trip? The CSV to JSON tool turns spreadsheet exports back into JSON. And if your destination is documentation rather than a spreadsheet, the CSV to Markdown Table tool renders the same data as a clean Markdown table.
Conclusion
Converting JSON to CSV is mostly about two things: mapping an array of objects into rows and columns, and quoting values correctly so commas and quotes don't wreck the layout. Keep your records flat, mind Excel's habit of reformatting numbers, and let a browser tool handle the escaping so your spreadsheet opens clean the first time.