What is a CSV to JSON converter?
CSV — comma-separated values — is the plain-text format nearly every spreadsheet, database client and analytics dashboard can export. Each line is a row, each comma separates a column. JSON — JavaScript Object Notation — is the format nearly every API, JavaScript app and document database wants to receive. A CSV to JSON converter rewrites the table as a JSON array of objects: the first row becomes the keys, and every row after it becomes one object. A file that starts name,age,city followed by Ada,36,Jakarta becomes [{"name": "Ada", "age": 36, "city": "Jakarta"}].
The conversion looks trivial until real-world CSV shows up. A naive split on commas breaks the moment a value contains a comma of its own — "Jakarta, Indonesia" is one city, not two columns. Real exports also contain quoted fields with line breaks inside them, doubled double quotes, semicolons instead of commas (common in European exports, where the comma is the decimal separator), tabs from pasted spreadsheet data, and rows that do not all have the same number of fields. This tool parses CSV the way the format actually works, following RFC 4180, instead of splitting on commas and hoping for the best.
How to convert CSV to JSON
- Paste the CSV into the box. It can come from Excel, Google Sheets, a database export, or a text editor. You can also upload a .csv file from the options panel, or drop a file onto the input box.
- Leave the delimiter on Auto-detect unless you know your file uses semicolons, tabs or pipes. The tool tries all four on the first rows and picks the one that gives a consistent field count.
- Check the header option. Keep “First row is the header” checked when the first row holds column names — those names become the JSON keys. Uncheck it when the file has no header row and you want generated keys instead.
- Click Convert to JSON. Read the preview table under the result: it shows the first five rows as parsed, so a wrong delimiter or a misread quote is visible before you copy anything.
- Copy the JSON or download it as a .json file. If your destination wants a different shape, switch the output to array of arrays or JSON Lines and convert again.
The stats line under the input tells you what happened: how many rows and columns were found, which delimiter was used, and how large the output is. If something is wrong, the error names the exact source row.
Delimiters, headers and types
Delimiters. “CSV” is a family, not one format. Comma is the default, but Excel in many European locales exports semicolons, pasted spreadsheet data is usually tab-separated, and some database dumps use pipes. Auto-detect scores comma, semicolon, tab and pipe against the first rows and picks the one that gives a consistent field count. If your file is a single column with no delimiter at all, it falls back to comma. When auto-detect guesses wrong, pick the delimiter by hand.
Headers. With the header option on, the first row supplies the JSON keys, in order. Duplicate column names are renamed rather than silently merged — two columns called email become email and email_2, and the note under the input says so, because silently dropping one of the two values would be data loss. Empty header cells are an error, with the column number named. With the header option off, every row becomes an object with generated keys col1, col2, col3 — or an array of values, if you choose the array-of-arrays shape.
Types. CSV stores everything as text; JSON distinguishes strings, numbers, booleans and null. With type detection on, 36 becomes the number 36, true and false become booleans, and an empty cell becomes null. Two guards keep this safe: a value with a leading zero, such as the ZIP code 02139 or the code 00721, stays a string, because turning it into a number would destroy information; and a value that only looks numeric in part, like 12px, stays a string too. Turn type detection off and every value stays a string, exactly as it appeared in the CSV.
Nested objects. With the nested option on, a header like user.name builds {"user": {"name": …}} instead of a flat key called user.name. It is off by default, because most destinations want flat keys.
Edge cases the parser handles
Quoted commas. "Jakarta, Indonesia" is one field. The parser tracks whether it is inside quotes, so a delimiter inside quotes never splits a field — the most common reason a hand-rolled split breaks.
Line breaks inside quoted fields. A quoted address or comment can span several lines, and the parser keeps it as one field. Blank lines between rows are skipped.
Doubled quotes. In CSV, a literal double quote inside a quoted field is written as two of them: "say ""hi""" means say "hi". A lone quote that never closes is reported as an unterminated quoted field, with the line where it started.
Ragged rows. When a row has more or fewer fields than the header, the tool stops and reports the exact source row number and both counts — for example, “Row 7 has 5 fields but the header has 4”. It never pads the short row or drops the extra values. The usual cause is an unquoted comma in a value; the row number tells you where to look.
Encoding quirks. A UTF-8 byte-order mark at the start of the file is stripped, so the first header does not arrive with an invisible character glued to it. CRLF (Windows), LF (Unix) and lone CR line endings are all accepted.
Three everyday uses
1. Feeding an API or a JavaScript app
A client sends a spreadsheet of products, users or orders, and your code wants JSON. Paste the export, convert, and paste the result into a fetch body, a test fixture or a seed script. Type detection means ages and prices arrive as numbers your code can add — and ZIP codes arrive intact, because the leading-zero guard keeps them as strings.
2. Seeding a database or a mock API
Document databases and mock servers eat JSON arrays of objects. A CSV of a few hundred rows becomes a seed file in seconds, and JSON Lines output is the shape bulk importers expect: one object per line, readable one line at a time. BigQuery, MongoDB's mongoimport and most log pipelines all accept it.
3. Turning an export into something you can diff
Two exports of the same table, a week apart, are hard to compare as CSV — column order, quoting and line endings all shift. Convert both to JSON with the same options and a text diff shows exactly which rows changed.
Common mistakes to avoid
- Splitting on commas by hand.
line.split(',')breaks on the first quoted comma, the first quoted line break, and the first doubled quote. Use a real CSV parser — every language ships one in its standard library. - Trusting type detection blindly. A column of product codes that happens to look numeric (
00123) is not a number. If a code lost its leading zeros in the preview, turn type detection off. - Forgetting the header row. Converting with the header option on when the file has no header turns your first data row into the keys — and the data in that row is gone. Uncheck the option and convert again.
- Ignoring the ragged-row error. A row with the wrong field count is almost always a real problem in the source — usually an unquoted comma in a free-text field. Fix the row instead of padding it.
- Pasting a Markdown table. A table copied from a chat window or a document, with
|borders and a---separator row, is not CSV. Paste the actual CSV export instead; guessing at Markdown would produce keys called---.
Frequently asked questions
- Is this CSV to JSON converter free?
- Yes. No account, no limits, no upload. Your CSV never leaves your browser, and there is no file-size cap beyond what your own machine can hold.
- Is my data sent to a server?
- No. Parsing and conversion run entirely in your browser. That matters because CSV exports often contain customer names and order history. You can test it: load the page, disconnect from the internet, and the tool still works.
- How does delimiter auto-detect work?
- The tool tries comma, semicolon, tab and pipe on the first rows and picks the one that gives a consistent field count. If your file has a single column, it falls back to comma. You can always override it by hand.
- What happens if a row has more or fewer fields than the header?
- The tool stops and tells you the exact source row number and how many fields it found versus how many the header has. It never silently drops the extra values or pads the missing ones, because silent data loss is worse than an error you can fix.
- Does it handle commas and line breaks inside quoted fields?
- Yes. The parser follows RFC 4180: a field wrapped in double quotes may contain the delimiter, a line break, or a doubled double quote ("") which becomes a single quote in the output.
- Will my ZIP codes lose their leading zeros?
- No. Type detection only turns a value into a number when it looks like a plain number with no leading zero, so 02139 and 00721 stay strings. Turn type detection off and every value stays a string, exactly as it appeared in the CSV.
- What is JSON Lines output for?
- JSON Lines (one JSON object per line) is the format many data tools expect for streaming and bulk import — BigQuery, MongoDB's mongoimport, and log pipelines among them. Each line is a complete JSON object, so a file can be read one line at a time.
- Can I convert a CSV with no header row?
- Yes. Uncheck “First row is the header” and every row becomes an object with generated keys col1, col2, col3 — or an array of values with the array-of-arrays shape.
Privacy
CSV is where customer data lives: names, email addresses, order history, internal prices. Pasting those into a server-side converter sends them to a stranger's log file — and some converters pass uploaded files through a server even when the conversion itself is client-side, or cap uploads at 1 MB. This tool has no upload path at all: paste, file upload and drag-and-drop are all read locally. Close the tab and the data is gone.
Worked example: a messy export, converted
Here is a small export very much like the ones that arrive from a real spreadsheet — a quoted comma, a doubled quote, and a multi-line address. Paste it into the tool and convert before reading on:
name,age,city,notes
Ada,36,"Jakarta, Indonesia","Loves ""BBQ"", weekends"
Bo,41,Oslo,"Line one
Line two"
The output is two objects. Ada's city stays one value, "Jakarta, Indonesia", instead of splitting into two columns; her note keeps its literal quotes, Loves "BBQ", weekends; and Bo's note keeps its line break inside a single string. The stats line reports 2 rows × 4 columns, delimiter comma (auto-detected). Now try breaking it on purpose: delete the closing quote after Indonesia and convert again. The tool reports an unterminated quoted field and the line where it started, instead of quietly producing the wrong number of columns.
One more experiment: turn type detection off and convert the same file. The ages come back as "36" and "41" — strings, not numbers. Same data, different types; keep the version that matches the system you are feeding.
Share this tool
Copy the link below and paste it anywhere. Whoever opens it gets the same free tool, with no account and nothing to install.