How to Convert a JSON Array to CSV
Turn a JSON array of objects into a CSV table — with nested objects flattened into columns and commas/quotes handled correctly, not just a naive join.
By QR Ivify Team
An API response that's an array of records, an exported dataset that only comes as JSON, a script's output you actually want to open in a spreadsheet — JSON and CSV represent the same kind of data (a list of similarly-shaped records) very differently, and converting between them correctly means handling a few real edge cases, not just splitting on commas.
What Makes This Conversion Non-Trivial
CSV is fundamentally flat — one row, one set of columns, no nesting. JSON has no such restriction — an object's value can itself be another object, or an array, or null. Converting JSON to CSV means making deliberate decisions about all of that:
- Nested objects get flattened into dot-notation columns —
{"address": {"city": "Hanoi"}}becomes a column literally namedaddress.city, rather than being dropped or dumped as unreadable[object Object]text. - Arrays and other non-flattenable values get represented as their JSON text in the cell, since CSV has no native multi-value field — this is the honest, lossless choice over silently discarding the data.
- Inconsistent objects (where some have a field others don't) still produce a valid table — the column set is the union of every field seen across the whole array, and a missing field just gets an empty cell.
- Values containing commas, quotes, or line breaks get properly quoted and escaped, so a value like
"Hello, world"doesn't accidentally split into two columns.
Step by Step
- Open JSON to CSV.
- Paste a JSON array of objects into the input panel.
- Click "Convert to CSV."
- Check the table preview on the right before downloading.
- Copy or download the CSV.
A Worked Example
Input:
[
{ "name": "John", "age": 30 },
{ "name": "Jane", "age": 28 }
]
Output:
name,age
John,30
Jane,28
What This Requires From Your JSON
The input has to be an array where every item is an object — a single object (not wrapped in an array), a primitive value, or an array of non-objects doesn't have a sensible row/column structure to convert to, and gets a clear error rather than a guessed, likely-wrong result.
Frequently Asked Questions
What if my JSON isn't an array of objects? You'll see the error "JSON must contain an array of objects" rather than an incorrect or empty CSV.
Are nested objects supported?
Yes — a nested object like {"address": {"city": "Hanoi"}} becomes its own column, named address.city.
Does this handle commas and quotes inside values correctly? Yes — any value containing a comma, quote, or line break is properly quoted and escaped per standard CSV rules.
What happens with null or missing values? Both become an empty cell in the output CSV.
Does this upload my JSON anywhere? No. Conversion happens entirely in your browser.
Try It
Need to turn a JSON array into a spreadsheet-ready CSV? QR Ivify's free JSON to CSV converter flattens nested data and handles CSV escaping correctly. Need to validate the JSON first? See JSON Validator.
Related articles
How to Decode Base64 Back to Text
Decode Base64 to text online for free, with correct Unicode handling and a clear error for invalid input instead of garbled output.
How to Base64 Encode Text (Without Breaking Unicode)
Encode text to Base64 online for free, with correct handling of Vietnamese, emoji, and other Unicode text — a common failure point in naive implementations.
How to Compare Two JSON Objects (Structurally, Not as Text)
Compare two JSON values online for free and see exactly what changed — key order and formatting differences are correctly ignored, unlike a plain text diff.