JSON to CSV
Convert JSON to CSV format
About JSON to CSV
JSON to CSV turns pasted JSON into comma-separated text with a header row. It takes an array of objects, a single object (one row) or an array of plain values (one value column). Every key seen in any object becomes a column, in first-seen order, keys such as 10 included; nested objects are flattened to dotted names and arrays to numbered ones. Numbers are copied exactly as written, so a 20-digit ID is not rounded. Values with a comma, a quote, a line break, or spaces at either end are quoted. The JSON is read and the CSV written inside your browser tab.
Example
Two objects with different keys, a nested address, and a tags array, and the CSV the tool returns:
JSON
[
{"id": 12345678901234567890, "name": "Ann", "address": {"city": "Paris"}, "tags": ["a", "b"]},
{"id": 2, "name": "Lee, Bo", "email": null}
]CSV
id,name,address.city,tags.0,tags.1,email 12345678901234567890,Ann,Paris,a,b, 2,"Lee, Bo",,,,
How to convert JSON to CSV
- 1Paste your JSON into "JSON input".
- 2Click "Convert".
- 3Check the header row and the columns in "CSV output".
- 4Take the result with "Copy", or keep it as data.csv with "Download".
Formats and limits
- Input
- JSON text: an array of objects, one object, or an array of values
- Output
- comma-separated text with a header row, saved as data.csv
- Missing keys and null
- empty cell
Where your file is processed
The JSON is parsed and the CSV built in your browser when you click "Convert"; the text you paste is not uploaded. If an error occurs, such as invalid JSON, we receive its message with quoted text masked, plus the tool name and your browser and version.
Frequently asked questions
Can it flatten nested JSON?
Yes. An address object with a city key becomes the column address.city, and a tags array becomes tags.0, tags.1 and so on, at any depth. An empty object or array is written as {} or [] so its column is not lost.
Is it a problem if objects have different keys?
No. The columns are the union of all keys, in the order they first appear in the JSON, and a row without a key gets an empty cell there. A null value also gives an empty cell, and true and false are written as words.
Can I convert a single JSON string or number?
No. The top level must be an array or an object; otherwise the tool answers that the JSON must be an array of objects, or a single object. An empty array is refused too, since it has no row to write.
Can I choose another separator than the comma?
No. The output always uses commas, with the header first and one row per line; a value holding a line break stays quoted over several lines. If you need tabs instead, copy the result and paste it into CSV to TSV, which detects the comma and writes tab-separated text.
Tips and tricks
- ✓To build JSON from a CSV file, use CSV to JSON, which can also type numeric columns.