How to convert CSV to JSON
- Keep CSV → JSON selected and paste your data – an export from Excel, Google Sheets or a database, or cells copied straight from a spreadsheet (those arrive tab-separated).
- Leave Delimiter on Auto-detect or pick comma, semicolon, tab or pipe yourself.
- With First row is a header ticked, each row becomes an object keyed by the column names. Untick it to get an array of arrays instead.
- Convert numbers and true/false turns numeric text into JSON numbers and
true,falseandnullinto their JSON values. Untick it to keep every value as a string. - Copy the result or click Download to save
data.json. The status line confirms how many rows were converted.
Example loads sample data for whichever direction is selected, which is a quick way to see how quoting is handled.
How to convert JSON to CSV
Select JSON → CSV and paste an array of objects. Every key found in any object becomes a column, in the order the keys first appear, so records with missing or extra fields still line up; missing values are left empty. Nested objects and arrays are written into one cell as JSON text, and null becomes an empty cell. An array of arrays is written row for row without a header, and a single object becomes a header plus one row. With the delimiter on Auto-detect, the output uses commas.
Download saves data.csv with a UTF-8 byte order mark at the start. Excel uses that mark to recognize the encoding, so accented letters and Korean, Japanese or Chinese text open correctly instead of as garbled symbols.
CSV quoting rules in brief
CSV has no single official specification, but RFC 4180 describes the common format, and this converter follows it:
- A field that contains the delimiter, a double quote or a line break is wrapped in double quotes:
"Paris, France". - A double quote inside such a field is written twice:
"Carol ""CJ"" Jones"meansCarol "CJ" Jones. - Quoted fields may span several lines; the line break becomes part of the value.
- When writing CSV, this tool also quotes values with leading or trailing spaces, so they aren’t trimmed by the program that opens the file.
Worked example
The CSV example on this page is:
name,city,age,member |
Alice,"Paris, France",34,true |
Bob,Tokyo,28,false |
"Carol ""CJ"" Jones",São Paulo,41,true |
It converts to three objects. The first is {"name": "Alice", "city": "Paris, France", "age": 34, "member": true}: the comma inside the quotes stays in the value, 34 becomes a number and true a boolean. The third row’s name comes out as Carol "CJ" Jones, which JSON writes as "Carol \"CJ\" Jones".
In the other direction, the JSON example has a tags array on Bob only. The result is the header name,city,age,tags, an empty tags cell for Alice, and "[""new""]" for Bob – the array as JSON text, quoted because it contains quotes.
How auto-detection and type conversion decide
- Delimiter: the first line is checked for commas, semicolons, tabs and pipes, and the most frequent one wins. If your header contains a comma inside quotes, or the first line is unusual, choose the delimiter manually.
- Numbers: only plain numbers are converted:
34,-2.5,1e3. Values with a leading zero (02134), a plus sign, thousands separators or a decimal comma (19,90) stay text, so ZIP codes, phone numbers and European-formatted prices are not damaged. - Booleans and null: only lowercase
true,falseandnullare converted;TRUEfrom Excel remains a string. - Headers: blank header cells are named
column1,column2and so on by position, and a repeated name gets_2appended so no column is lost.
Pitfalls to watch for
- Long IDs. JSON numbers lose precision beyond about 15–16 digits, so
12345678901234567890would become12345678901234567000. Turn off type conversion when a column holds long account numbers, order IDs or barcodes. - Ragged rows. With a header, a row with fewer cells gets empty strings for the missing columns, and cells beyond the last header column are dropped. If data seems to vanish, check for an unquoted comma in a value.
- Semicolon CSV for Excel. In regions that use a decimal comma, such as Germany or France, Excel expects semicolon-separated files. Choose Semicolon before converting JSON to CSV if the file will be opened there.
- Blank lines are skipped, and both Windows (CR LF) and Unix (LF) line endings are understood.
FAQ
Is the JSON output valid for APIs and code?
Yes, it is standard JSON with two-space indentation. To minify it or check a file you edited by hand, paste it into the JSON Formatter.
Can I convert an Excel file directly?
Not an .xlsx file, but you can select the cells in Excel or Google Sheets, copy, and paste here. The tab-separated text is detected automatically.
Where does my data go?
Nowhere. Parsing and conversion run in the page itself, which matters when the spreadsheet holds customer or employee records.
Why do my columns appear in a different order?
For JSON → CSV, columns follow the order in which keys first appear across the objects. Put the keys you want first into the first object, or reorder the columns in your spreadsheet afterwards.