JSON to CSV Converter
Convert a JSON array of objects into CSV. Nested objects are flattened into dotted column names, and the header row includes every key found in any row.
How JSON becomes a CSV table
JSON (RFC 8259) can nest objects and arrays to any depth, while CSV (RFC 4180) is a single flat table. To bridge the two, this converter treats each item of a JSON array as one row and flattens anything nested into extra columns with dotted names. The header row is the union of every key it finds, so objects with different fields still line up.
How to convert JSON to CSV
- Paste JSON into the JSON Input pane, open a
.jsonfile with File, or fetch an API response with URL (the API must allow cross-origin requests). - Click Convert. Invalid JSON is reported with your browser's parser message instead of a result.
- Use Copy, or Download to save
converted.csv. Clear empties both panes.
Buttons and views explained
- Convert — parses the input with the browser's
JSON.parseand writes comma-separated output with a header row, LF line endings and a final newline. - Tree Viewer — shows the input JSON as a collapsible tree in the output pane, which helps you see which array will become the rows. Click it again to return to the CSV.
- Path copying — click a node in the tree, or place the cursor in the input and press Ctrl+C (Cmd+C on a Mac) without selecting anything, to copy its path. With text selected, Ctrl+C copies the text as usual.
Flattening rules
| JSON input | CSV result |
|---|---|
| Array of objects | One row per object; columns in order of first appearance |
Nested object {"address": {"city": "Leeds"}} | Column address.city |
Array inside an object {"tags": ["a", "b"]} | Columns tags.0, tags.1 |
| Empty object or array as a value | The text {} or [] in the cell |
null or a missing key | An empty cell |
Object with exactly one key holding an object or array, such as {"data": [...]} | Unwrapped, repeatedly, until something else is reached |
| A single object with several keys | One row |
Array of plain values [1, "two"] | A single column named value |
| Array of arrays | Columns Field1, Field2…; every inner array, including the first, is a data row |
Example
{"data": [
{"id": 1, "name": "Ada", "address": {"city": "London"}, "tags": ["admin"]},
{"id": 2, "name": "Grace, Rear Adm.", "email": "[email protected]"}
]}
converts to:
id,name,address.city,tags.0,email
1,Ada,London,admin,
2,"Grace, Rear Adm.",,,[email protected]
The data wrapper is removed because it is the only key. If the response also had a "total": 2 next to data, the whole object would become a single row with columns such as data.0.id; paste just the array in that case.
Common problems and fixes
| Symptom | Cause | Fix |
|---|---|---|
One very wide row with columns like items.0.name | The array sits inside an object that has other keys, so it is not unwrapped. | Paste only the array, or delete the other keys first. |
A long ID changed, e.g. 12345678901234567890 became 12345678901234567000 | JavaScript numbers are 64-bit floating point and cannot hold integers above 253 exactly. | Have the API send large IDs as strings. |
1.10 came out as 1.1, 1e3 as 1000 | Numbers are re-written from their parsed value, not copied as text. | Send the value as a string if its exact formatting matters. |
| A column is missing | A key literally named with a dot, such as "a.b", clashes with a nested a → b, and only one survives. | Rename the clashing key before converting. |
| The output is empty | The input is an empty array. | Check you pasted the right part of the response; the Tree Viewer helps. |
| “Invalid JSON” with a position | Trailing commas, comments or single quotes, which JSON does not allow. The wording depends on your browser. | See common JSON syntax errors, or fix it in the JSON Formatter. |
A note on formulas in spreadsheets
Values are written as they are, so a string such as =1+2 stays =1+2 in the CSV, and a spreadsheet opening the file may treat it as a formula. If the JSON comes from users or another untrusted source, read OWASP's page on CSV injection before handing the file to someone who will open it in Excel.
Frequently asked questions
Why do some rows have empty cells?
The header is the union of all keys. If one object has an email and another does not, the second row gets an empty cell in that column. A null value also becomes an empty cell, so the CSV cannot tell the two apart.
Can I choose a different delimiter, such as a semicolon?
No, the output always uses commas. Pass the result through the CSV to TSV converter if you need tabs, or import it into Excel with Data > From Text/CSV if your regional settings expect semicolons.
Can I convert the CSV back into the same JSON?
Not exactly. The CSV to JSON converter reads every value as a string and does not rebuild nested objects from dotted headers, so numbers, booleans and nesting are lost on the way back.
Does it accept JSON Lines (one object per line)?
No. The input must be one JSON value. Wrap the lines in [ and ] and add a comma at the end of every line except the last.
Is my data uploaded?
No. Parsing and conversion happen in your browser and the JSON is not sent anywhere. If you use the URL button, your browser requests that address directly; the response is not passed through any server of ours.