JSON to CSV

Runs in browser JSON & Data

Turn JSON arrays into spreadsheet-ready CSV. Nested objects are flattened using dot notation, values are quoted correctly, and you can choose the delimiter.

Privacy: This tool runs entirely in your browser. Your input never leaves your device.
Loading tool…

How to use JSON to CSV

  1. Paste a JSON array of objects.
  2. Choose the delimiter and whether nested keys should be flattened.
  3. Check the preview table, then copy or download the CSV.

JSON to CSV features

  • Converts arrays of objects (or API envelopes like { "data": [...] }) to CSV
  • Flattens nested objects and arrays into dot-notation columns
  • Comma, semicolon, tab or pipe delimiter and optional CRLF line endings
  • RFC 4180 quoting for commas, quotes and newlines
  • Row/column statistics and a table preview of the first rows
  • Download as .csv ready for Excel or Google Sheets

JSON to CSV example

Customers with a nested address

Input:

[{"id":1,"name":"Omar","address":{"city":"Riyadh"}},{"id":2,"name":"Sara, J.","address":{"city":"Jeddah"}}]

Output:

id,name,address.city
1,Omar,Riyadh
2,"Sara, J.",Jeddah

Frequently asked questions about JSON to CSV

What input shape is expected?

An array of objects works best — each object becomes a row and the union of all keys becomes the header. A single object becomes one row, and { "data": [...] } style API envelopes are unwrapped automatically.

How are nested objects and arrays handled?

They are flattened into dot-notation columns such as address.city and tags.0. Turn flattening off to keep nested values as JSON strings in a single cell.

Will Excel open the file correctly?

Yes. Fields containing the delimiter, quotes or newlines are quoted per RFC 4180. Choose the semicolon delimiter if your Excel locale uses commas as the decimal separator.

What happens when rows have different keys?

Missing values are written as empty cells, so every row has the same number of columns.

Technical notes

Rows come from toRowObjects: an array of objects maps one-to-one, arrays of arrays become column1…n, primitives land in a value column, and a lone object is unwrapped only when it holds a data, items, results, rows or records array (checked in that order). Flattening uses flattenJson with a dot for keys and array indices alike (tags.0); empty objects and arrays survive as {} and []. The header is the union of keys in first-seen order.

Cells are written by escapeCsvField: a field is quoted only when it contains the chosen delimiter, a double quote, CR/LF or leading/trailing whitespace, with inner quotes doubled per RFC 4180. Numbers use JavaScript formatting (1e21 → 1e+21, 0.1 + 0.2 → 0.30000000000000004), null becomes an empty cell, and neither a UTF-8 BOM nor a trailing newline is added. Leading =, +, - or @ are not neutralised, so apply your own CSV-injection policy before opening untrusted data in a spreadsheet.