CSV to JSON and JSON to CSV Converter: Comma, Semicolon and Tab Delimiters
Paste CSV to get a JSON array with one object per row, keyed by the header line, or switch to JSON to CSV and paste an array of objects to get a spreadsheet-ready table. The delimiter is detected automatically, so files exported from Excel in European locales with semicolons, or tab-separated data copied from a spreadsheet, convert without changes; you can also pick the delimiter yourself. Quoted fields containing commas, quotes and line breaks are handled as the CSV standard describes. Data is converted in your browser and never uploaded.
CSV to JSON
The first line is read as the header, and each following line becomes an object whose keys are the header names:
name,email,role
Alex Morgan,alex@example.com,admin
"Koval, Nadia",nadia@example.com,editor
[
{ "name": "Alex Morgan", "email": "alex@example.com", "role": "admin" },
{ "name": "Koval, Nadia", "email": "nadia@example.com", "role": "editor" }
]
All values come out as strings, because CSV has no types: 42, true and 2026-01-01 are just text in a CSV file, and guessing types silently turns ZIP codes such as 02134 into the number 2134. Convert the fields you need in your code, where you know what each column means. Empty lines are skipped, a missing value becomes an empty string, and a UTF-8 byte order mark at the start of the file, which Excel adds, is removed so it does not end up in the first key.
Three more rules shape the output. Leading and trailing spaces are trimmed from every cell, quoted or not. If two header columns share a name, the later column overwrites the earlier one in each object, so rename duplicate headers before converting. And a row with more cells than the header loses the extra cells.
JSON to CSV
Paste an array of objects. The columns are the union of all keys in the order they first appear, so objects with different fields still line up; a missing field gives an empty cell. Values that contain the delimiter, a double quote or a line break are wrapped in quotes, and quotes inside them are doubled, which is exactly what spreadsheets expect.
CSV is flat, so nested objects and arrays are written into the cell as JSON text, for example {"city":"Oslo"}. If you need separate columns such as address.city, flatten the data before converting. The output uses the delimiter you choose; with auto-detect it uses commas. Rows end with a plain line feed rather than the CRLF that RFC 4180 describes, which spreadsheets and CSV libraries read without complaint.
The CSV format
CSV means comma-separated values. There was never a single strict standard, but RFC 4180, published in 2005, documents the format most software follows: records are separated by line breaks, fields by commas, and a field containing a comma, a double quote or a line break is enclosed in double quotes, with any quote inside doubled.
id,comment
1,"He said ""hello"""
2,"Line one
Line two"
3,plain text
Three records, not four: the quoted line break belongs to the second record's comment. Splitting CSV with line.split(',') breaks on exactly these cases, which is why a real parser, like the one in this converter, reads character by character and tracks whether it is inside quotes.
Semicolons, tabs and Excel
Excel uses the operating system's list separator when it saves CSV. In locales where the decimal separator is a comma, such as Germany, Spain, France or Ukraine, that separator is a semicolon, so a "CSV" file from Excel often looks like name;price with 12,50 as a number. The converter's auto-detection picks the delimiter that splits the header into the most columns, so these files work as they are.
Tab-separated values, TSV, are what you get when you copy cells from Excel or Google Sheets. Paste them directly; the tab is detected like any other delimiter. When opening UTF-8 CSV files in Excel, accented characters may appear garbled unless the file starts with a byte order mark or is imported through Data > From Text/CSV with UTF-8 selected.
Converting in code
# Python: CSV to JSON
import csv, json
with open('users.csv', newline='', encoding='utf-8-sig') as f:
print(json.dumps(list(csv.DictReader(f)), ensure_ascii=False))
# jq: JSON array to CSV
jq -r '(.[0] | keys_unsorted) as $k | $k, (.[] | [.[$k[]]]) | @csv' users.json
In Python, encoding='utf-8-sig' strips an Excel byte order mark and newline='' lets the csv module handle quoted line breaks. In JavaScript, Papa Parse is the widely used parser for both directions; pandas' read_csv and to_json suit large files.
CSV injection
When you export user-supplied data to CSV for someone to open in a spreadsheet, a cell that starts with =, +, - or @ may be run as a formula. OWASP calls this CSV injection or formula injection. If an export will be opened in Excel or Google Sheets, prefix such values with a single quote or otherwise neutralise them on the server that produces the file.
The JSON to CSV mode here writes values exactly as given, so a string such as =HYPERLINK(…) is still a formula when the result is opened in a spreadsheet. That is right for your own data; for exports of user input, add the escaping in the code that produces the file.
Frequently asked questions
How do I convert CSV to JSON?
Select CSV to JSON and paste the CSV, including the header line. Each row becomes an object keyed by the header names, and the delimiter is detected automatically.
Can it handle semicolon-separated files from Excel?
Yes. Auto-detection recognises comma, semicolon, tab and pipe delimiters, or you can choose the delimiter manually.
Why are numbers strings in the JSON output?
CSV has no data types, so every value is text. Converting automatically would damage values such as ZIP codes with leading zeros, so convert types in your code where you know each column's meaning.
How are commas inside values handled?
Fields containing the delimiter, quotes or line breaks must be enclosed in double quotes, as RFC 4180 describes. The converter reads such fields correctly and writes them that way when producing CSV.
What happens to nested JSON when converting to CSV?
Nested objects and arrays are written into a single cell as JSON text. Flatten the data first if you need each nested field in its own column.
Is my data uploaded?
No. The conversion runs in your browser and the data is not sent to a server or stored.