JSON to CSV Converter
Convert a JSON array of objects into a CSV file with automatic headers and proper escaping.
JSON is the native format for APIs, but the people who consume data - analysts, managers, spreadsheet users - live in CSV. Converting between the two is a daily chore for anyone who pulls an API response and needs it in Excel or Google Sheets. This converter turns a JSON array of objects into a ready-to-open CSV file with correct quoting and a header row.
Paste your JSON array and press Convert. The tool reads the keys across every object, builds a header row in first-seen order, and writes one CSV line per object. Fields containing commas, quotes or newlines are quoted and escaped correctly, so the output opens cleanly in any spreadsheet rather than splitting into extra columns.
Missing fields are written as empty cells, so objects with different key sets still produce a well-formed table. The conversion runs entirely in your browser - your data never leaves the page, which matters when the JSON contains customer records or other sensitive fields.
Features
- Header row built automatically from object keys, in first-seen order.
- Correct RFC-4180-style quoting for commas, quotes and newlines inside values.
- Missing keys written as empty cells, so ragged objects still make a clean table.
- CRLF line endings and quoted cells - the format spreadsheets expect.
- Nested values serialized as JSON text inside their cell.
- One-click download as a .csv file, ready to open in Excel or Sheets.
- Fully offline - the JSON is processed locally and never uploaded.
How to Use
- 1
Paste a JSON array
The input must be an array of objects, for example the items array from an API response. A single object or an empty array has no rows to export.
- 2
Convert
Press Convert to CSV. The tool assembles the header row and one line per object with proper escaping.
- 3
Copy or download
Copy the CSV text, or use Download to save a .csv file you can open directly in Excel, Sheets or Numbers.
- 4
Open in a spreadsheet
Import the file with the comma delimiter. The header row becomes column names and every object becomes a row.
Example
Array of objects to CSV
[
{ "name": "Ada, Lovelace", "role": "Engineer" },
{ "name": "Linus", "role": "Maintainer" }
]↓
name,role
"Ada, Lovelace",Engineer
Linus,MaintainerRagged objects become empty cells
[
{ "a": 1, "b": 2 },
{ "a": 3 }
]↓
a,b
1,2
3,Common Problems
Feeding a single object instead of an array
The converter expects an array of objects, because a table needs rows. If you paste one object, wrap it in square brackets first, or use the CSV-to-JSON tool in reverse for a single record.
Ignoring quoting for commas and quotes
A name like "Ada, Lovelace" contains a comma that would split the column. The converter wraps such values in quotes and doubles any embedded quotes, matching what spreadsheets expect.
Nested objects and arrays in cells
A value that is itself an object or array cannot be a flat spreadsheet cell. The converter serializes it as JSON text inside the cell, which keeps the data intact even if the column is not typed.
Forgetting that header order follows first occurrence
Columns appear in the order keys are first seen across the objects. If your objects list keys differently, the header order will follow the first object - reorder the input if you need a specific column layout.
Hand-editing the output in a text editor
Opening a CSV in a plain editor can mangle line endings or quoting. Use a spreadsheet program, which parses the format correctly, or re-run the conversion after changing the source JSON.
Assuming CSV handles every data type
CSV is text - numbers, booleans and null all become strings in the file. A spreadsheet may re-infer types on import, which is usually what you want, but the raw file itself is always text.
Technical Details
The header row is built by scanning every object's keys in document order and keeping the first occurrence of each. Columns therefore reflect the actual data, not a hard-coded schema.
Cells are quoted only when needed: a value is wrapped in double quotes if it contains a comma, a double quote or a line break, and embedded quotes are doubled per RFC 4180. Everything else is written bare.
Rows are joined with CRLF line endings and commas, the byte-level convention that Excel and Google Sheets open without ambiguity.
Values that are objects or arrays are serialized with JSON.stringify into their cell, so complex fields round-trip without losing information.
Conversion is local and synchronous. No data leaves your browser, and nothing is cached between sessions.
The converter serializes only the keys that actually appear in the data - there is no empty-column filler and no schema guessing. What you paste is exactly what becomes the table.
Frequently Asked Questions
Why does my JSON need to be an array?
A CSV file is a table of rows, and a table maps naturally to an array of objects. A single object can be wrapped in brackets to convert, but a bare object has no row structure to export.
Will fields with commas break my spreadsheet?
No. Any cell containing a comma, quote or newline is wrapped in quotes and internal quotes are escaped. Spreadsheet programs read that correctly instead of splitting the column.
How are missing keys handled?
As empty cells. If one object lacks a key that other objects have, that row gets a blank cell, so the table stays rectangular and imports cleanly.
Can I convert JSON to Excel directly?
This tool produces CSV, which Excel and Google Sheets open natively. Use the download button to save the .csv file, then open it in your spreadsheet - no separate conversion step needed.
Is my data sent to a server?
No. The conversion runs entirely in your browser. The JSON is parsed and serialized in memory and never transmitted or stored.
Why does the number 007 become 7 in my spreadsheet?
That happens in the spreadsheet program, not here - CSV is text and preserves "007" literally. Excel re-infers numeric types on import and drops the leading zero. This converter keeps the raw text intact.
Data & Privacy
Your data stays in your browser. Nothing is uploaded.
- Processing
- Local
- Upload
- None
- Server Storage
- None
- Account
- Not required
Related Tools
JSON Formatter
Format, validate and beautify JSON directly in your browser.
JSON & Data
JSON Validator
Validate JSON and pinpoint the first error with a line, column and plain-English explanation.
JSON & Data
JSON Minifier
Compress formatted JSON into a single compact line and see exactly how many bytes you save.
JSON & Data
JSON Diff
Compare two JSON documents and see every added, removed or changed value with its exact path.
JSON & Data
CSV to JSON Converter
Convert CSV files into a clean JSON array, with optional automatic type detection.
JSON & Data
JSON to TypeScript Converter
Generate TypeScript interfaces or type aliases from a JSON sample, with nested types inferred.
JSON & Data