- Paste CSV or open a
.csv/.tsvfile. Files that are not valid UTF-8 are read as Windows-1252, which is what Excel's plain "CSV" format uses on Western Windows systems. - Check the status bar: it shows the detected delimiter, the row and column count, and any problems with line numbers. Override the delimiter if detection guessed wrong.
- Untick Header row if the first line is data; keys then become
column1,column2and so on. - Choose Array of objects for records, or Array of arrays for a compact grid where the header, if any, is the first element.
- Use the table preview to confirm the columns lined up, then copy or download the JSON.
CSV to JSON Converter
Convert CSV or TSV into a JSON array, with delimiter detection, type inference and clear reports of malformed rows.
Overview
CSV is the lowest common denominator for tabular data: every spreadsheet, database and reporting tool can export it. Turning it into JSON is the usual first step when you want to seed a database, mock an API response, feed a chart or write a test fixture. The hard part is not splitting on commas, it is the details: quoted fields with commas and line breaks inside them, files saved with semicolons by a European copy of Excel, byte order marks, and ZIP codes that must not become numbers.
This converter uses a parser written for this page that follows RFC 4180 and tolerates the common deviations. It detects the delimiter, turns rows into objects keyed by the header, infers numbers and booleans carefully, and tells you which line is malformed instead of producing silently shifted columns. The data never leaves your browser.
How to convert CSV to JSON
CSV has no single standard
RFC 4180 is an informational memo from 2005 that describes the common format and registers
the text/csv media type. It is not a strict standard that tools must follow, and
many do not. Its main rules: records end with CRLF, fields containing commas, quotes or line
breaks are enclosed in double quotes, and a quote inside a quoted field is written twice.
id,comment
1,"Said ""hello"", then left"
2,"First line
second line"
That file has two records, not three, and the parser reads it that way. It also accepts what
real exports contain: LF or CR line endings, a UTF-8 BOM, and semicolon, tab or pipe
delimiters. Detection tries each candidate on the first rows and keeps the one that gives the
most consistent field count; when several fit equally, semicolon wins over comma, because a
semicolon file written in a European locale often contains decimal commas like
1,50.
Type inference without losing data
Every CSV value is text. With Detect types on, values that are clearly numbers, booleans or null become JSON types, and anything that would change by conversion stays a string:
| CSV value | JSON | Why |
|---|---|---|
42, -3.5, 1e3 | 42, -3.5, 1000 | Plain JSON-style numbers. |
007, 02134 | "007", "02134" | Leading zeros are identifiers, not quantities. |
4111111111111111 | "4111111111111111" | More than 15 digits cannot be stored exactly as a double. |
true, FALSE | true, false | Lower, upper and title case are recognised. |
null, NULL | null | An explicit null marker. |
| (empty) | "" | Empty is not the same as null; missing trailing fields become null. |
1,000, $5, 2024-01-15 | strings | Formatted values are left for your code to interpret. |
Spaces count: 42 stays a string unless you tick Trim spaces,
which is useful for files written as a, b, c.
Malformed rows and Excel exports
The status bar lists problems by line number instead of guessing:
Line 14: unclosed quotemeans a field opened with"never closed, so everything after it was read as one value. Look for a missing closing quote a few lines further down.Line 6: unexpected text after a closing quoteis usually an unescaped quote inside a quoted field, such as an inch mark in"27" monitor". It should be written"27"" monitor".Line 9: expected 5 fields, found 6usually means an unquoted comma inside a value. Extra fields get keys likecolumn6, and missing ones are filled withnull(or an empty string when type detection is off).
Line numbers count physical lines, so the record after one with a quoted line break starts
two lines later. If the CSV came from Excel, check whether the damage happened before export:
leading zeros already stripped from ZIP codes, long IDs already turned into
1.23457E+15, or text such as 1-2 reformatted as a date. No converter
can restore those values. Duplicate or blank header names are made unique
(id, id_2, column3) so no column is overwritten.
To go the other way, use the JSON to CSV converter. To check the result, paste it into the JSON viewer or compare two exports with the diff checker.
Frequently Asked Questions
Is the CSV uploaded to a server?
No. The file is read and parsed in your browser. The last input is kept in local storage so it is still there after a refresh; Clear removes it.
Why did a value like 007 stay a string?
Converting it to the number 7 would lose information. Values with leading zeros, and digit strings longer than 15 characters, are kept as strings even when type detection is on.
How do I convert a TSV file?
Paste it or open it; tab-separated data is detected automatically. You can also set Delimiter to Tab explicitly.
Can it handle line breaks inside a cell?
Yes, as long as the field is enclosed in double quotes, which is what Excel and Google Sheets
write. The line break is kept in the JSON string as \n (or \r\n
if the file used Windows line endings).
How large a file can I convert?
Files of several megabytes work. Above 2 MB the conversion runs when you click Convert rather than on every keystroke, and the preview shows only the first 50 rows.