JSON to CSV Converter
Convert a JSON array of objects to CSV. Columns are the union of every row's keys, fields are quoted only where needed, and nested values and formula-style cells are flagged.
Paste an array of objects. Every key that appears in any row becomes a column; nested objects and arrays are written as JSON text and counted so they are not a surprise.
How awkward values are written
Each CSV below is this page's output from when the site was built. These are the cases that decide whether a file opens cleanly in a spreadsheet or an importer: mismatched keys, quoting, line breaks, nesting, null, and cells that a spreadsheet might execute.
Rows with different keys
The columns are every key seen in any row, in the order first seen; a row without a key gets an empty cell.
JSON
[{"a":1,"b":"x"},{"a":2,"c":true}]
CSV
a,b,c 1,x, 2,,true
Commas and quotes inside values
A field is quoted only when it has to be, and a quote inside it is doubled, as RFC 4180 specifies.
JSON
[{"name":"Smith, J","note":"said \"hi\""}]
CSV
name,note "Smith, J","said ""hi"""
A line break inside a value
Quoted so the break stays inside the cell instead of starting a new row.
JSON
[{"t":"line1\nline2"}]
CSV
t "line1 line2"
Nested objects and arrays
CSV has no nesting, so nested values are written as JSON text and counted, so you can decide whether to flatten them first.
JSON
[{"a":{"b":1},"l":[1,2]}]
CSV
a,l
"{""b"":1}","[1,2]"
2 nested values flagged
null and an empty string
Both become an empty cell. CSV cannot tell them apart, so the difference is lost on the way.
JSON
[{"a":null,"b":""}]
CSV
a,b ,
Cells that look like formulas
A value that starts with =, +, -, @, a tab or a carriage return is counted as a formula risk, because Excel and Sheets may run it when the file is opened, unless the whole value is a number such as -2 or +1. The text is written unchanged; the count is a warning.
JSON
[{"f":"=SUM(A1:A2)"},{"f":"@x"},{"f":"-2"},{"f":"+1"}]
CSV
f =SUM(A1:A2) @x -2 +1
2 formula-like cells flagged