Skip to content
ZeroServer.tools

JSON to CSV Converter

Convert a JSON array of objects to CSV. Auto-detects columns, handles nested values. Instant.

or drop a file here
CSV output (3 rows, 3 cols)

Convert JSON to CSV online

Paste a JSON array of objects — the converter automatically detects all column headers from the keys across every row. Fields containing commas, quotes, or newlines are properly escaped per RFC 4180. Nested objects or arrays become JSON-encoded strings in their cell. The Download button saves the result as a.csv file readable by Excel, Google Sheets, or any spreadsheet tool. For the reverse, try the CSV to JSON Converter. To validate your JSON first, use JSON Formatter.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Getting an API response into a spreadsheet for someone who does not want JSON.
  • Flattening a list of records for import into a system that only takes CSV.
  • Producing a table from a payload to scan a column for outliers.
  • Extracting a subset of fields into a compact tabular form.
  • Handing structured data to a colleague in the format their tooling expects.

How it works in practice

A worked example

An API response has to reach a colleague as a spreadsheet, and the records in it are not all the same shape.

Input
[
  { "id": 1, "name": "Ada, Countess", "address": { "city": "London" } },
  { "id": 2, "name": "Bob \"the Builder\"", "tags": ["a","b"] },
  "not an object",
  { "id": 4, "note": "line one\nline two" }
]
Output
id,name,address,tags,note
1,"Ada, Countess","{""city"":""London""}",,
2,"Bob ""the Builder""",,"[""a"",""b""]",
,,,,
4,,,,"line one
line two"

Five columns out of four records, because the header row is the union of every key in the order each was first seen — the last field exists on one object only and still earns a column, and every other row gets an empty cell for it. The nested address arrived as a single cell holding its own JSON with the inner quotes doubled, since a two-dimensional format has nowhere else to put a tree. The comma inside one name and the quotes inside another are both handled by the standard quoting rule, and the embedded newline means four records occupy six physical lines.

The edge case that catches people

The third row is the one to notice, because it is nothing but commas and nothing warned you. An element of the array that is not an object — a bare string, a number, another array — has no key that can land in any column, so it is written as a row of empty cells and the record is simply gone. The reported row count still says four, so the loss does not even surface as a missing line. If a payload might be a mixture, compare the row count against what you expected rather than against what came out.

When not to use this tool

When the destination can read JSON, which is more often than people assume. This format carries no types and no schema, so every consumer downstream re-guesses what each column means, and a conversion that loses the nesting cannot be undone further along the chain. The output is also plain UTF-8 with no byte-order mark, which is correct for every tool except the one people actually double-click: Excel on Windows will read accented names through the system codepage instead, and the file has no way to tell it otherwise.

Frequently Asked Questions

What JSON structure works best for CSV conversion?
An array of flat objects works best: [{"name":"Alice","age":30},{"name":"Bob","age":25}]. Each object becomes a row and keys become headers. Deeply nested objects serialize as [object Object] — flatten them first.
What happens to nested JSON objects or arrays?
Nested values are stringified into a single cell. To get nested fields as separate columns, flatten the JSON first (e.g. convert {"address":{"city":"NYC"}} to {"address.city":"NYC"}) before converting.
Can I convert to TSV (tab-separated) instead?
Yes. Select the Tab delimiter option to produce a TSV file. TSV is preferred when your data contains commas, avoiding the quoting overhead of standard CSV.
How are special characters (commas, quotes, newlines) handled?
Values containing commas, double quotes, or newlines are wrapped in double quotes per RFC 4180. Embedded double quotes are escaped by doubling them (" → "").
Can I open the resulting CSV in Excel or Google Sheets?
Yes. Download the file and open it directly. If accented characters appear garbled in Excel, use Data → Import and choose UTF-8 encoding when opening.
How are nested objects flattened into columns?
By joining the path — `address.city` becomes one column. Arrays are the harder case: either one column per index, or a serialised string, and neither round-trips cleanly back to the original JSON.

Common errors and gotchas

  • Assuming nested objects flatten sensibly. CSV is two-dimensional and nesting has to be encoded or dropped.
  • Losing records whose keys differ, where a column present in only some objects becomes ambiguous.
  • Overlooking that a value containing a comma, a quote or a newline must be quoted and escaped.
  • Letting a spreadsheet reinterpret the output, turning long ids into scientific notation and text into dates.
  • Expecting types to survive. CSV carries no types, so every consumer guesses again.

Related Converters tools

Private & free — this tool runs entirely in your browser.

IndieKitShip your Next.js startup in days.affiliate