How to Convert a JSON Array to CSV and Turn CSV Back into JSON
Learn how to turn a JSON array of objects into a downloadable CSV, parse simple CSV back into JSON, and avoid the input shapes the converter rejects.
JSON to CSV Converter
Introduction
API responses arrive as JSON while spreadsheets and reporting tools expect CSV. The JSON to CSV Converter reads an array of objects, uses the keys of the first object as the header row and writes one quoted line per record; the reverse mode splits CSV lines on commas and builds an array of objects. Conversion runs in the browser as you type and the data never leaves the page.
Step-by-Step Instructions
- Pick the JSON to CSV Spreadsheet mode and paste a JSON array of objects into the Input JSON Array box.
- Check the red alert area; it reports Invalid JSON format errors or tells you the array must be non-empty.
- Read the Converted CSV Output panel, where each value is wrapped in double quotes and internal quotes are doubled.
- Switch to CSV to JSON Array to paste CSV with a header row and at least one data row, then review the pretty-printed JSON.
- Click Download File to save converted_data.csv or converted_data.json, or use Copy to grab the text.
Key Use Cases
- Export for Excel: Turn a list of user records from an API into a CSV file that opens directly in a spreadsheet.
- Fixture Data: Convert a hand-written CSV table into a JSON array for tests or seed scripts.
- Quick Inspection: Paste a JSON payload to see its fields laid out as columns before building a report.
Frequently Asked Questions
What JSON shapes does the converter accept?
The input must be a non-empty array of objects. A single object, a bare value or an empty array produces the error 'JSON must be a non-empty array of objects.' Column headers come from the keys of the first object only, so keys that appear only in later objects are dropped, and missing or null values become empty cells.
How are nested objects and arrays handled in CSV output?
Each value is converted with string concatenation, so a nested object becomes the text [object Object] and an array becomes its elements joined by commas inside the quoted cell. Flatten nested structures before converting if you need separate columns.
Does CSV to JSON support commas inside quoted fields?
No. Each line is split on every comma, then surrounding quotes are stripped from each piece. A quoted value such as "Doe, John" is split into two cells. All parsed values are strings, so numbers are not converted to numeric types.