How to Convert JSON to CSV for Excel and Google Sheets
A step-by-step guide to converting JSON arrays into CSV for spreadsheets: structuring the input, flattening nested fields, handling arrays, choosing the right delimiter and encoding, and avoiding broken imports.
Analysts and product teams constantly receive JSON from APIs but need tables they can sort, filter, and chart in Excel or Google Sheets. Converting JSON to CSV is the fastest bridge between the two worlds — provided you structure the input correctly, flatten nested fields in a predictable way, and pick the delimiter and encoding your spreadsheet expects. This guide walks through the whole conversion, including the edge cases that quietly corrupt a spreadsheet import.
Start with an array of objects
CSV is a flat table: rows and columns. The JSON shape that maps cleanly onto it is an array of objects, where each object becomes one row and its keys become the column headers. Before converting, make sure your data is in that form — if your API wraps the array in an envelope like { "data": [...] }, extract the inner array first.
[
{ "id": 1, "name": "Ada", "active": true },
{ "id": 2, "name": "Linus", "active": false }
]id,name,active
1,Ada,true
2,Linus,falseFlatten nested objects
Spreadsheets have no concept of nesting, so a nested object must be flattened into multiple columns. The common convention is dotted path notation: a field address.city becomes a column named address.city. A converter walks the object and produces one column per leaf value, so the table stays lossless even when the source is deeply nested.
{ "id": 1, "address": { "city": "London", "zip": "EC1" } }
// becomes:
// id,address.city,address.zip
// 1,London,EC1Handle arrays inside rows
Arrays are the trickiest part of flattening because a single cell cannot hold a list natively. You have a few options depending on the data. Arrays of simple values — like tags — can be joined into one cell with a separator such as a semicolon or pipe. Arrays of objects are usually kept as a JSON string in one cell for later processing, or, when each item deserves its own row, expanded so the parent fields repeat. Decide based on how the spreadsheet will be used: joining is friendlier for humans, while a JSON string preserves structure for re-import.
{ "id": 1, "tags": ["red", "blue"] }
// joined: id,tags -> 1,"red;blue"
// json: id,tags -> 1,"[\"red\",\"blue\"]"Quoting, commas, and special characters
CSV has its own escaping rules, and ignoring them is the most common cause of a mangled import. Any value that contains the delimiter, a double quote, or a line break must be wrapped in double quotes, and literal double quotes inside it must be doubled. A good converter does this automatically, but it is worth knowing why a name like "Smith, Jr." needs quoting — without it, the comma splits one field into two and every column after it shifts.
id,note
1,"Smith, Jr."
2,"She said ""hi"""Delimiters and encoding for Excel
Excel's CSV expectations depend on your regional settings, which causes a lot of confusion. In locales that use a comma as the decimal separator (much of Europe), Excel expects a semicolon as the field delimiter, while US Excel defaults to a comma. If your columns all land in one cell on import, the delimiter is the likely culprit — switch it to match the target locale, or use the import wizard to choose it explicitly.
Encoding matters too. Save the file as UTF-8 so accented characters and non-Latin scripts survive; for older Excel versions, a UTF-8 byte-order mark helps it detect the encoding. Google Sheets handles UTF-8 cleanly and lets you pick the delimiter on import, so it is often the more forgiving target.
Convert it without spreadsheets gymnastics
Rather than wrangling formulas or scripts, paste your JSON into a JSON to CSV converter, which handles flattening, quoting, and delimiter choice for you, then download a file ready to open. For deeply nested payloads, running the data through a JSON Flatten step first gives you full control over the column names before export. And when a colleague sends you a spreadsheet you need back as JSON, a CSV to JSON converter reverses the trip. Everything runs in your browser on JsonDrift, so customer data in those exports never leaves your machine.
Frequently asked questions
What JSON structure converts best to CSV?
An array of flat objects with consistent keys. Each object becomes a row and each key becomes a column. If your objects have different keys, the converter unions them and leaves blanks where a value is missing, which is usually what you want.
How are nested objects handled in the CSV?
They are flattened into separate columns using dotted path names, so address.city and address.zip become two columns. This keeps the conversion lossless without forcing the spreadsheet to understand nesting.
Why do my columns split in the wrong places when I open the CSV in Excel?
Usually a delimiter or quoting mismatch. If a value contains a comma but is not quoted, Excel splits it into extra columns. If your locale uses semicolons, comma-delimited data lands in a single column. Use UTF-8 encoding, ensure values with commas are quoted, and pick the delimiter that matches your Excel locale.
How do I keep arrays from breaking the table?
Decide per field. Join arrays of simple values into one cell with a separator like a semicolon, or keep arrays of objects as a JSON string in a single cell. If each array item should be its own row, expand the array and repeat the parent columns for each item.
Can I convert the CSV back to JSON later?
Yes. A CSV to JSON converter reads the header row as keys and each subsequent row as an object. If you flattened with dotted column names, a converter that understands that convention can rebuild the original nested structure on the way back.
Related tools
Try these tools
JSON to CSV Converter
Convert JSON arrays and nested objects into clean, flattened CSV ready for spreadsheets.
CSV to JSON Converter
Turn CSV and spreadsheet data into structured JSON arrays.
JSON Flattener
Flatten nested JSON into a single-level object with dot or underscore keys.
JSON Formatter & Beautifier
Format, prettify, and beautify messy JSON with configurable indentation and key sorting.