How to use the CSV to JSON Converter
- Paste CSV into the box, open a .csv or .tsv file, or click Load sample.
- Leave Delimiter on Auto-detect, or choose comma, semicolon, tab or pipe yourself.
- Say whether the first row holds column names, and whether numbers, booleans and null should be detected.
- Choose an array of objects or an array of arrays, pick the indentation, then copy or download the JSON.
Features
- Full RFC 4180 parsing: quoted fields, doubled quotes and line breaks inside values
- Automatic delimiter detection for comma, semicolon, tab and pipe
- Type detection that keeps ZIP codes and IDs with leading zeros as text
- Output as an array of objects or an array of arrays
- Unique keys for blank or repeated header names
- Warnings with line numbers for ragged rows and stray quotes
Why CSV is harder to parse than it looks
It is tempting to read CSV by splitting each line on commas, and that works until the first real-world file arrives. A name such as "Brown, Kevin" contains the delimiter, a note can contain a line break, and a value can contain quotation marks of its own. A naive split turns one record into two, shifts every column to the right and quietly corrupts the data. This converter uses a proper state-machine parser instead, so the structure of the file is read the way spreadsheet programs write it.
The rules it follows
CSV is described by RFC 4180. The parser applies these rules:
- Fields are separated by the delimiter, and records end with a line break (CRLF, LF or a lone CR are all accepted).
- A field wrapped in double quotes may contain the delimiter and line breaks.
- Inside a quoted field, a double quote is written as two:
"Prefers ""Kev"""meansPrefers "Kev". - Spaces are part of the value and are kept exactly as written.
Messy files
Exports from older systems often bend the rules. If a quote appears in the middle of an unquoted value, or text follows a closing quote, the parser keeps the text and warns you rather than refusing the whole file. Blank lines are skipped. The one problem it cannot work around is a quoted value that never closes, because everything after it would be swallowed; the error tells you the line where that value starts so you can fix it.
How delimiter detection works
Not every “comma-separated” file uses commas. Excel in many European locales saves with semicolons because the comma is the decimal separator, database tools often export tab-separated values, and some systems use the pipe character. Auto-detect parses the first rows with each candidate and picks the one that splits the most rows into the same number of fields, preferring more columns when results tie. If your file has a single column, or the guess is wrong, choose the delimiter manually.
What type detection changes
Every CSV value is text. With type detection on, values that clearly represent something else are converted:
| CSV value | JSON value | Why |
|---|---|---|
42, -3.5, 1e6 | Number | Valid JSON number syntax |
02134 | "02134" | A leading zero means a code, not a quantity |
1,234 | "1,234" | Thousands separators are ambiguous |
12345678901234567890 | Text | Too large to store exactly as a number |
true, TRUE, false | Boolean | Case is ignored |
Empty cell or null | null | No value |
Turn detection off when every value must stay a string, for example when another program will validate the types itself.
Objects or arrays?
An array of objects uses the header row as property names, which is what most APIs, databases and JavaScript code expect. Blank header cells become column1, column2 and so on, and repeated names get a suffix such as email_2 so no value is overwritten. An array of arrays keeps the raw grid, including the header row, which is compact and preserves column order exactly.
To go back the other way, use the JSON to CSV converter, and check the result with the JSON Formatter.
Frequently asked questions
Does it handle commas inside values?
Yes. Any value wrapped in double quotes can contain commas, semicolons, tabs and even line breaks, and it stays one value in the JSON output.
Why did my ZIP code stay a string?
Values with a leading zero, like 02134, are kept as text because converting them to numbers would drop the zero. Other whole and decimal numbers become JSON numbers when type detection is on.
What happens to duplicate column names?
Each key must be unique in a JSON object, so a repeated header gets a numeric suffix, such as email and email_2. Blank headers are named column1, column2 and so on.
Can I convert TSV or semicolon-separated files?
Yes. Auto-detect recognizes tab, semicolon and pipe delimiters, and you can also pick one manually from the Delimiter menu.
What if some rows have fewer values than the header?
Missing values become null (or empty strings when type detection is off), extra values get generic column names, and a warning shows the first line where it happened.
Is my CSV uploaded anywhere?
No. The file is read and converted by your browser, so spreadsheets with personal or business data never leave your computer.