Skip to content
koducathome

JSON to CSV

Convert an array of JSON objects into CSV, flattening nested objects into dot-notation columns.

How to use this tool

Steps for using the JSON to CSV.

  1. Paste JSON into the Input JSON editor, click Upload JSON to open a .json or .jsonl file (read locally, never uploaded), or click Sample. Arrays of objects, single objects, API responses such as {"data": [...]} and JSON Lines are all accepted.
  2. The CSV updates as you type. Check the Table preview, or switch to CSV to see the raw text with each column in its own colour.
  3. Pick a Delimiter (comma, semicolon, tab or pipe), how Arrays are written and the Line endings. Toggle Header row, Flatten nested, Quote all and Escape formulas as needed.
  4. Click column names in the Columns bar to leave columns out of the output; All brings them back.
  5. Copy the result or Download it — the file is named after your upload and gets a .tsv extension for tab-separated output. Turn on Excel UTF-8 BOM if accents or emoji look wrong in Excel.

Example

Nested objects become dot-notation columns

JSON array
[
  {"id": 1, "name": "Ada", "address": {"city": "London"}, "tags": ["admin", "beta"]},
  {"id": 2, "name": "Grace, H.", "address": {"city": "New York", "zip": "10001"}}
]
CSV (comma, arrays as JSON)
id,name,address.city,tags,address.zip
1,Ada,London,"[""admin"",""beta""]",
2,"Grace, H.",New York,,10001

Common use cases

  • Opening an API response in Excel, Google Sheets or LibreOffice for analysis or sharing with non-developers.
  • Exporting records from a document database (MongoDB, Firestore, DynamoDB) into a spreadsheet.
  • Preparing data for bulk-import tools that only accept CSV, such as CRMs and email platforms.
  • Loading JSON data into a SQL database with COPY or LOAD DATA via a CSV file.
  • Safely exporting user-submitted data with formula escaping before handing it to colleagues.

How JSON is flattened into CSV

CSV is a flat table, while JSON can nest objects and arrays to any depth. Each object in the top-level array becomes one row. Nested objects are flattened into columns named with dot notation, so {"address": {"city": "London"}} produces an address.city column. Columns are the union of every key found in every row, in the order they are first seen, so a key that only appears in the last object still gets a column and earlier rows leave that cell empty.

Arrays have no natural column layout, so they are kept in a single cell. By default the cell holds the array as JSON text, which is lossless and can be parsed back. Joined mode writes the items separated by ; , which is easier to read in a spreadsheet but cannot be reversed reliably. Objects inside a joined array are written as JSON. null becomes an empty cell, booleans become true/false, and empty objects are written as {}.

Quoting follows RFC 4180: a field is wrapped in double quotes only when it contains the delimiter, a double quote, a carriage return or a line feed, and double quotes inside a field are escaped by doubling them (""). Rows end with CRLF by default, as the RFC specifies and as Excel expects; choose LF for Unix command-line tools. Because quoting depends on the delimiter, Grace, H. needs quotes in comma-separated output but not with semicolons.

CSV files opened in a spreadsheet can execute content: a cell that starts with =, +, - or @ is treated as a formula, which attackers abuse to exfiltrate data or run commands ("CSV injection"). With Escape spreadsheet formulas on, any text cell — including header names — that starts with one of those characters, a tab or a carriage return is prefixed with a single quote, which spreadsheets display as plain text. JSON numbers are never prefixed, so -5 stays numeric. Leave the option off when the CSV is going to a program rather than a person, because the quote becomes part of the value.

Limitations

  • Arrays are not expanded into multiple rows or numbered columns; each array occupies one cell.
  • If a key containing a dot (such as "a.b") collides with a flattened nested key, the later value wins.
  • The CSV is UTF-8. Copied text never has a byte order mark; turn on Excel UTF-8 BOM to add one to downloaded files for Excel.
  • When a wrapper object holds several arrays of objects, the first one found (breadth-first) is converted — click Use whole object instead to convert the object itself.
  • The table preview shows the first 500 rows; the CSV text and downloads always contain every row.
  • Input is limited to 2 million characters.

Frequently asked questions

What JSON shapes can be converted?

An array of objects (the usual case), a single object (one row), an array of plain values (one value column), an API response that wraps the rows (for example {"data": [...]} — the array is found automatically), or JSON Lines with one value per line. A bare string, number or null at the top level cannot be turned into rows and is reported as an error.

Why do some cells have doubled quotes?

That is how CSV escapes a double quote inside a quoted field. "[""admin""]" is read by any CSV parser as ["admin"].

Which delimiter should I use for Excel?

Excel uses the list separator from your system's regional settings. In regions that write decimals with a comma (much of Europe and South America) it expects semicolons; elsewhere commas work. Tab-separated output works in both when pasted directly into a sheet.

What does formula escaping do to my data?

It adds a leading ' to text cells that begin with =, +, - or @ (and tab or carriage return), so spreadsheets show them as text instead of evaluating them. The apostrophe is visible to programs that read the file, so only enable it for files meant for spreadsheet users.

Is my data uploaded?

No. Parsing, flattening and CSV generation run entirely in your browser, and the download is created locally.