JSON to CSV

Converts a JSON array of objects into CSV that opens correctly in Excel, Google Sheets or Numbers — with proper quoting, so values containing commas, quotation marks or line breaks survive the trip instead of shifting your columns.

Live demo · real result from this tool

CSV

id,name,city,tags,email
1,Asha Rao,Bengaluru,"[""admin""]",
2,"Smith, John",London,,
3,"Li ""Leo"" Wei",,,li@example.com

Preview (3 of 3 rows)

idnamecitytagsemail
1Asha RaoBengaluru["admin"]
2Smith, JohnLondon
3Li "Leo" Weili@example.com

Processed on your device — nothing is uploaded.

How to use JSON to CSV

  1. Paste a JSON array of objects — the top level must be an array, not a single object.
  2. Press convert; syntax errors are reported rather than guessed at.
  3. Copy the CSV, or save it as a .csv file and import it into your spreadsheet.
  4. The input must be an array. Wrap a single object in square brackets, or extract the array your API nested it inside.
  5. Nested objects and arrays are written as JSON text within one cell.
  6. Conversion runs in your browser, so exported customer or transaction data is not uploaded anywhere.

Where the columns come from

The header row is the union of every key across every object, in the order each key is first seen. That matters when your objects are not uniform — an API that omits null fields, or a export where later records gained a column. Taking the keys from the first object alone, which is the usual shortcut, silently drops those later columns. Objects missing a key get an empty cell rather than a shifted row.

Quoting is what makes the file actually open

CSV has one real rule and it is easy to get wrong: a field containing a comma, a double quote or a line break must be wrapped in double quotes, and any quote inside it doubled. Without that, an address field with a comma in it becomes two columns and every subsequent column in that row shifts left. This converter applies the RFC 4180 rules, so a value like he said “hi” or a multi-line note imports as one cell. It also preserves 0 and false, which naive converters turn into blanks.

Nested objects and arrays

CSV is flat and JSON is not, so nested values are written as their JSON text inside a single cell rather than expanded into columns. That keeps the data rather than losing it, but a deeply nested payload is a poor fit for a spreadsheet either way — if you need the nested fields as columns, flatten the JSON first so each leaf has its own top-level key.

Opening it without Excel mangling it

Excel will interpret anything that looks like a date, so an ID like 03-04 becomes 3 April and a long number loses its trailing digits to scientific notation. The reliable fix is to use Data → From Text/CSV rather than double-clicking the file, and set those columns to Text during the import. Google Sheets is better behaved but does the same to long numeric IDs.

Frequently asked questions

What JSON structure is required?
The JSON should be an array of objects with consistent keys. Each object becomes a row, and keys become column headers.
How are nested objects handled?
Nested objects are flattened one level with dot notation (like user.name). For complex nesting, consider flattening JSON first.
Can I import the CSV to Excel?
Yes, the output is standard CSV that can be opened in Excel, Google Sheets, or any spreadsheet application.
Why does my JSON not convert?
The commonest reason is that the top level is an object rather than an array — many APIs return { "data": [ ... ] }, and you need the inner array. The other is invalid JSON, usually a trailing comma or a comment, which JSON does not permit; the error message names the position.
Will commas inside my data break the CSV?
No. Any value containing a comma, a double quote or a newline is quoted according to RFC 4180, and internal quotes are doubled, so spreadsheets read it as a single cell.
Why do my long ID numbers change when I open the file?
That is Excel, not the CSV. Numbers beyond fifteen digits lose precision and long digit strings get converted to scientific notation. Import via Data → From Text/CSV and mark those columns as Text, or prefix them with an apostrophe.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close