CSV to JSON

Paste CSV or open a .csv file to get JSON. Quoted values, line breaks inside quotes and semicolon or tab separators are all read correctly, and you can see how each row was split.

  • 100% free
  • Runs in your browser
  • No uploads
Output
Layout

How to convert CSV to JSON

  1. Paste CSV or open a file. Comma, semicolon, tab and pipe separated files work; the separator is detected for you.
  2. Check the header option. With First row is headers on, each row becomes an object keyed by the column names. Off, keys are column1, column2 and so on.
  3. Choose the output. Objects gives [{"name": "Ada"}], Arrays gives [["name"], ["Ada"]]. Pick 2 or 4 spaces, or Minified for one line.
  4. Copy or download the JSON. The table under the boxes shows how the rows were read.

Example with tricky quoting

id,name,city,active
1,Ada Lovelace,London,true
2,"Turing, Alan",Manchester,false
3,"Katherine ""Kat"" Johnson","Hampton, VA",true

becomes:

[
  {"id": 1, "name": "Ada Lovelace", "city": "London", "active": true},
  {"id": 2, "name": "Turing, Alan", "city": "Manchester", "active": false},
  {"id": 3, "name": "Katherine \"Kat\" Johnson", "city": "Hampton, VA", "active": true}
]

The commas inside quotes stay in the value, the doubled quotes become one quote (escaped as \" in JSON), and with type detection on, 1 and true become a number and a boolean.

How values are typed

CSV valueJSON with detection onWhy
42, -3.5, 1e642, -3.5, 1e6Plain numbers, kept digit for digit.
007"007"A number would lose the zeros.
1,000"1,000"Thousands separators aren't part of JSON numbers.
TRUE, falsetrue, falseAny capitalisation.
nullnullThe word null only.
(empty)""Empty cells stay empty strings.

Common problems and fixes

  • "The quoted value that starts on line N is never closed." A value opens with a quote and never closes it, so the rest of the file looks like one value. Add the closing quote, or remove the stray one.
  • Everything is in one column. The file uses a separator that wasn't detected. Choose it under Delimiter.
  • Accented letters look wrong. The file isn't UTF-8. Re-save it as CSV UTF-8 from Excel and open it again. UTF-16 files saved as Unicode text are read correctly.

Frequently asked questions

Does it handle commas and line breaks inside values?

Yes. Values in double quotes can contain the delimiter, line breaks and quotes (written twice, as "" inside the value), exactly as the CSV standard and Excel do. The preview table shows how every row was split, so you can check before you copy.

How is the delimiter detected?

It looks at the first lines and picks the character (comma, semicolon, tab or pipe) that splits them into the same number of columns most consistently, ignoring anything inside quotes. If it guesses wrong, choose the delimiter yourself.

Why are some numbers still strings?

Values like 007, 1,000 or +44 20 7946 0000 aren't plain numbers: turning them into JSON numbers would drop zeros or fail. Only values written the way JSON writes numbers (42, -3.5, 1e6) are converted. Turn off type detection to keep every value as a string.

What if rows have different numbers of values?

Missing values become empty strings and extra values get their own keys (column4, column5 and so on). A note lists the line numbers of those rows, which usually point to an unquoted comma or a stray quote.

Can I convert an Excel file?

Save it as CSV first (File, Save As, CSV UTF-8 in Excel; File, Download, CSV in Google Sheets), then open the CSV here. Copying cells from a spreadsheet and pasting also works: it pastes as tab-separated text, which is detected automatically.