CSV to JSON Converter - Header Row, Delimiter Detection, Quoted Fields

Paste CSV, or open a file, and get JSON as a list of objects (using the first row as the names) or as a list of lists.

About this tool

The reader follows RFC 4180: quoted values can hold commas, line breaks and doubled quotes, and files from Excel that use semicolons or tabs are detected automatically. Numbers stay text unless you ask for conversion, so a code such as 007 is never changed. Everything runs in your browser.

How it works

The reader is a small state machine written for this tool, not a library. It goes through the text one record at a time. A value that starts with a double quote runs to the next lone double quote, so it can contain the delimiter, line breaks and two double quotes in a row, which stand for one quote. Records end at CRLF, LF or a lone CR. A byte order mark at the start of the file is dropped, and one line break at the end does not create an empty row. Where real files break the rules the reader is forgiving and tells you: a quote inside an unquoted value is kept as text, and text after a closing quote is kept and added to the value.

Detect looks at the first records and picks the delimiter (comma, semicolon, tab or pipe) that splits them into the same number of columns most often, with at least two columns. That is how a file such as Product;Price;In stock, with a decimal comma in 850,50, is read correctly. You can also choose the delimiter yourself. With the header option on, the first row gives the keys. An empty name becomes column3 and so on, and a repeated name gets _2, _3 added. A row with fewer values than the header is padded with empty values, and a row with more gets extra keys called column4 and so on. If you would rather stop, choose to report the first uneven row as an error with its row and line number.

Conversion is off by default, because guessing types loses data. When it is on, only text written the way JSON writes numbers is converted: an optional minus sign, digits with no leading zero, an optional decimal part and an optional exponent. So 42, -3.5 and 1e3 become numbers, but 007, +5, .5, 1,234 and 0x1F stay text. A number with more than 15 significant digits also stays text, because a JSON number is a 64 bit float and would lose its last digits (a 16 digit card or account number is the usual victim). The number is written exactly as it appears, so 10.50 stays 10.50. The words true and false in any case become booleans and null becomes null. A separate option turns empty cells into null. Dates are never converted.

If a quoted value is never closed, the tool does not guess. It reports the row, the line and the column where the quote was opened, because everything after an open quote would otherwise be swallowed into one value. Empty lines are skipped, and they still count in row numbers so the numbers match what a spreadsheet shows. The JSON text is written by the tool itself, in the same order as the CSV columns, so a header such as 2024 stays where it is instead of moving to the front the way a JavaScript object would, and a header named __proto__ is an ordinary key. Choose 2 or 4 spaces, a tab or minified output.

Worked examples

Quotes, commas and a line break

The row 1,Nimal Perera,Colombo,"Likes tea, not coffee",1200.50 becomes an object with the note Likes tea, not coffee and the balance "1200.50". Inside quotes, ""call me later"" reads as the text "call me later", and a value that runs over two lines is written with \n in the JSON string.

An Excel file with semicolons

Product;Price;In stock followed by Ceylon tea;850,50;true is detected as semicolon separated and becomes {"Product": "Ceylon tea", "Price": "850,50", "In stock": "true"}. With conversion on, true becomes the boolean true but 850,50 stays text, because a comma is not a JSON decimal mark.

Uneven rows

For code,name,qty with the rows 007,Widget,12 and 008,Gadget and 009,Gizmo,4,spare, padding gives Gadget an empty qty and adds a key column4 that is empty for the first two rows and spare for Gizmo. With conversion on, qty 12 and 4 become numbers and the code stays "007" in every row.

A missing closing quote

For the header a,b followed by the line 1,"2 and no closing quote, the error is: Row 2 (line 2, column 3): a quoted field is opened here but never closed. Fix the quote and the conversion runs.

How text is converted when conversion is switched on

Text in the CSVBecomes in the JSONWhy
4242A plain whole number
-3.50-3.50A plain decimal number, written exactly as it appears
1e31e3A number with an exponent
007"007"A leading zero marks a code, not a number
+5"+5"JSON numbers have no plus sign
1,234"1,234"A thousands separator is not JSON
12345678901234567"12345678901234567"More than 15 digits would lose precision as a number
TRUEtruetrue and false in any case are booleans
nullnullnull in any case is null
(empty cell)""An empty string, or null when "Empty cells become null" is on

Frequently asked questions

How does the tool choose the delimiter?

It reads the first records with each of comma, semicolon, tab and pipe, and picks the one that splits them into the same number of columns most often (at least two). If you disagree, choose the delimiter yourself. A file with one column has no delimiter, and then a comma is assumed.

What happens when a value contains a comma or a line break?

If the value is in double quotes, the comma or line break is part of the value. That is the RFC 4180 rule. Two double quotes in a row inside quotes stand for one quote. If the quotes are missing, the comma ends the value, because there is no way to tell it apart.

Why are my numbers strings in the JSON?

Conversion is off by default, so every value is text. Switch on Convert numbers, true/false and null to get real numbers. Even then, text like 007, +5 or a number with more than 15 digits stays text, because converting it would change or lose data.

What happens to rows with a different number of values?

By default a short row is padded with empty values and a long row gets extra keys named column4, column5 and so on, and the tool tells you how many rows were affected. Choose to report as an error and the conversion stops at the first uneven row and names its row and line.

Can I convert an Excel .xlsx file?

Not directly. In Excel use Save As and choose CSV, in the UTF-8 version if your Excel offers it, then open that file here. Excel on a computer with a comma as the decimal mark often saves with semicolons, which the tool detects.

How are accented letters and other alphabets handled?

The Open a file button reads the file as UTF-8. If the bytes are not valid UTF-8, it reads the file as Windows-1252, which is what Excel on Windows often writes, and tells you. A byte order mark at the start is removed. Text you paste is already text, so no decoding applies.

Does it keep the order of the columns?

Yes. The JSON is written in CSV column order, including headers that are whole numbers, which a JavaScript object would move to the front.

Is my CSV uploaded anywhere?

No. The file is read and converted by JavaScript in your browser tab, and nothing is sent to a server.

How big a file can I convert?

Up to 25 million characters, which is about 25 MB of plain text. The Open a file button reads files up to 40 MB. The JSON box shows the first 200,000 characters of a long result, and Copy and Download use the whole result.

Updated Oct 15, 2026