JSON to CSV
What is a Json To Csv?
APIs and databases return JSON, but analysts, finance teams and spreadsheets want CSV. This converter turns a JSON array of objects into CSV: it collects the keys as column headers, writes one row per object and quotes values correctly so the file opens cleanly in Excel, Google Sheets or any data tool.
How to use it
- Paste a JSON array of objects.
- Review the detected headers and rows.
- Copy the CSV or save it as a .csv file.
Example
Input (double quotes in real JSON):
[
{ 'id': 1, 'name': 'Asha', 'city': 'Pune' },
{ 'id': 2, 'name': 'Ben', 'city': 'Leeds, UK', 'vip': true }
]Output:
id,name,city,vip
1,Asha,Pune,
2,Ben,"Leeds, UK",trueThe header includes every key found in any object, missing values are left empty, and the value containing a comma is wrapped in double quotes.
Handling nested data
CSV is flat, so nested objects and arrays need a decision:
- Flatten nested keys into dotted columns, such as
address.city. - Serialize them as JSON text in a single cell.
- Explode arrays into multiple rows, which is usually done in code.
Tips for spreadsheets
- Excel may reformat long numbers, such as phone numbers or IDs with leading zeros. Import via Data, From Text/CSV and set those columns to Text.
- Save with UTF-8 encoding so accented characters display correctly; Excel recognises UTF-8 reliably when the file has a byte order mark.
- Use a consistent key order in your objects to control column order.
Frequently Asked Questions
How are CSV headers chosen?
From the keys of the objects. Every key that appears in any object becomes a column.
What happens to nested objects?
CSV is flat, so nested values must be flattened into dotted columns or stored as JSON text in one cell.
Why does Excel change my numbers?
Excel auto-formats values. Import the CSV and set columns such as IDs and phone numbers to Text.
How are commas inside values handled?
Values containing commas, quotes or line breaks are wrapped in double quotes, following the CSV standard.