JSON to CSV Converter
Convert a JSON array of objects to CSV. Nested objects and arrays are spread into columns, and every cell is quoted correctly.
JSON to CSV Converter: the tool
Input
CSV
The result appears here.How to use JSON to CSV
- Paste a JSON array of objects, or a single object. Press Example to see how nested data is handled.
- Pick the delimiter. Many European versions of Excel expect a semicolon rather than a comma.
- Choose how nested values are written: spread into columns such as address.city, or kept as JSON text in one cell.
- Copy the CSV or download it as a .csv file.
Example
Two records with nested fields. The address becomes two columns and the tags become numbered columns.
[{"id":1,"name":"Ada Lovelace","email":"ada@example.com","address":{"city":"London","zip":"EC1"},"tags":["math","code"]},{"id":2,"name":"Alan Turing","email":"alan@example.com","address":{"city":"Wilmslow","zip":"SK9"},"tags":["logic"]}]id,name,email,address.city,address.zip,tags.0,tags.1 1,Ada Lovelace,ada@example.com,London,EC1,math,code 2,Alan Turing,alan@example.com,Wilmslow,SK9,logic,
About this tool
CSV is a flat table, and JSON is a tree, so the conversion needs rules. The columns are the union of all keys in all records, in the order they first appear. A record that lacks a key gets an empty cell, and null is also written as an empty cell.
With Spread into columns, a nested object becomes dotted column names (address.city) and array items are numbered (tags.0, tags.1). Empty objects and arrays are written as {} and [] so that they are not silently dropped. With Keep as JSON text, each nested value is written as compact JSON in a single quoted cell.
Cells are quoted exactly when needed, following RFC 4180: when they contain the delimiter, a double quote or a line break, or start or end with a space. Numbers are copied exactly as written, so large identifiers are not rounded. If the file will be opened in a spreadsheet and the data comes from users, turn on Neutralize spreadsheet formulas to prefix cells that start with =, +, - or @, which prevents CSV injection.
Frequently asked questions
What JSON can be converted to CSV?
A top-level array of objects is the usual case. A single object becomes one row, an array of arrays becomes rows without column names, and an array of plain values becomes a single column called value.
How are nested objects and arrays handled?
By default they are spread into columns with dotted names, such as address.city and tags.0. Choose Keep as JSON text if you prefer one column holding the nested value as JSON.
Why does Excel show garbled accents?
The CSV is UTF-8 text. Double-clicking such a file can make Excel assume an older encoding. In Excel, use Data, then From Text/CSV, and choose UTF-8 as the file origin. Google Sheets and LibreOffice detect UTF-8 directly.
What is CSV injection and should I worry about it?
Spreadsheets run cells that start with =, +, - or @ as formulas. If those cells come from untrusted input, opening the file could execute something unintended. Turn on Neutralize spreadsheet formulas to prefix such cells with an apostrophe. Plain negative numbers are left alone.
Are large numbers preserved?
Yes. Numbers are copied as written, so a 20-digit identifier is not rounded. Be aware that Excel itself shows more than 15 digits in scientific notation unless the column is formatted as text.
More developer tools
- csv→CSV to JSON ConverterConvert CSV to a JSON array of objects. Quoted fields, embedded line breaks and any delimiter are handled, and identifiers keep their leading zeros.
- { }JSON Formatter & ValidatorFormat, validate and minify JSON. Errors point to the exact line and column, and nothing you paste leaves your browser.
- →xmlJSON to XML ConverterConvert JSON to well-formed XML with a root element you choose. Arrays repeat their element, and invalid names are repaired and reported.
- ok?JSON ValidatorCheck JSON against the specification and get the exact line and column of the first error, plus a summary of what the document contains.