Drag & drop a CSV file here, or
Supports .csv and .txt files
Quick answer
A CSV-to-JSON converter reads the first row as column headers and turns every following row into a JSON object keyed by those headers, collecting them into an array. This tool is RFC 4180 compliant: it handles quoted fields containing commas, escaped quotes and real line breaks, auto-detects comma, semicolon, tab or pipe delimiters, and converts numbers and booleans to real JSON types — all in your browser, nothing uploaded. Paste CSV, click Convert to JSON, then copy or download as JSON or NDJSON.
How This Tool Converts CSV to JSON
- The first row of your CSV is treated as the header row. Its column names become the keys for every JSON object in the output array. Untick First row is a header if your data starts straight at the first record.
- Each subsequent data row becomes one JSON object. Column order is preserved and each value is mapped to the header key of its column.
- The delimiter is detected from the header row — comma, semicolon, tab or pipe — by counting each candidate outside quoted regions. You can also pick one explicitly or type a custom character.
- Fields wrapped in double quotes are parsed correctly, including values containing the delimiter, escaped double quotes (
""→ a literal") and real line breaks. The parser reads the file as one character stream and tracks quote state across newlines, exactly as RFC 4180 requires. - With Detect numbers & booleans on,
42becomes the number42andtruebecomes a boolean. Values that would not survive the trip — leading zeros like007, integers beyondNumber.MAX_SAFE_INTEGER, and+-prefixed values — are deliberately kept as strings. - Empty cells stay as empty strings (
"") unless Empty cells as null is ticked.
Worked example
This CSV packs in every case that trips up naive parsers at once: an embedded comma, escaped quotes, a real line break inside a quoted field, a leading-zero code, a boolean and an empty trailing cell.
Input CSV
name,age,zip,active,note
Alice,30,007,true,"Likes ""tea"", coffee
and long walks"
Bob,25,90210,false,
Output JSON
[
{
"name": "Alice",
"age": 30,
"zip": "007",
"active": true,
"note": "Likes \"tea\", coffee\nand long walks"
},
{
"name": "Bob",
"age": 25,
"zip": 90210,
"active": false,
"note": ""
}
]
What happened
- The header row became the object keys; each data row became one object — two records, not three, even though the file spans four physical lines.
ageis the number30andactiveis the booleantrue, because type detection is on by default.zipstayed the string"007"for Alice — converting it would destroy the leading zeros. Bob's90210has no leading zero, so it became a number.- Alice's quoted
notekept its internal comma and its line break; each doubled quote""became a single"(escaped as\"in JSON). - Bob's trailing empty cell became
""rather than being dropped.
Edge cases & gotchas
- Type detection is deliberately conservative.
007,9007199254740993and+15551234stay strings, because converting them would silently change the value. Zip codes, product codes and phone numbers survive intact. Switch the option off entirely if you want every value as a string. - A UTF-8 BOM is stripped automatically. Files exported from Excel often start with an invisible byte order mark. Left in place it becomes part of the first header name, so
row.idsilently returnsundefined. The converter removes it and tells you it did. - Duplicate headers are renamed, not dropped. A second column named
idbecomesid_2, because JSON keys must be unique. You get a notice rather than silent data loss. - Ragged rows are tolerated. Missing trailing values become
""; extra cells beyond the header count are ignored. A notice reports how many rows were affected. - Semicolon files are common outside the US. Excel in many European locales writes
;as the list separator. Auto-detect handles it, but you can force the delimiter if a file has an unusual header.
When to Use CSV to JSON
- When you have a spreadsheet export (Excel, Google Sheets) and need to load the data into a JavaScript application, REST API, or NoSQL database.
- When a data pipeline produces CSV output and a downstream step expects JSON as input.
- When importing bulk records (users, products, transactions) into an application that reads a JSON array.
- When you want to inspect CSV data using JSONPath or
jqwithout writing a custom parser.
Frequently Asked Questions
How does the CSV to JSON converter work?
The first row of your CSV is treated as the header row and becomes the JSON object keys. Each subsequent row becomes a JSON object in the output array.
Is my CSV data sent to a server?
No. All conversion happens entirely in your browser using JavaScript. Your data never leaves your device.
Does it handle commas inside CSV fields?
Yes. Fields wrapped in double quotes are handled correctly, including commas and escaped double quotes ("") inside quoted fields.
Can I upload a CSV file instead of pasting?
Yes. Click "Choose File" or drag and drop a .csv or .txt file onto the drop zone. The file contents are loaded into the editor automatically.
Does my CSV need a header row?
Not necessarily. By default the first row is treated as the header row and its values become the JSON keys. If your data has no header, untick "First row is a header" and the converter will either generate col1, col2, col3 keys or output each row as a plain array, whichever you choose.
Are numbers and booleans detected automatically?
Yes, when "Detect numbers and booleans" is enabled (it is on by default). A cell containing 42 becomes the number 42, true and false become real booleans, and the word null becomes null. Values that cannot survive the conversion are deliberately left as strings: leading zeros such as 007, integers larger than JavaScript can represent exactly, and numbers with a leading plus sign. This keeps IDs, zip codes and phone numbers intact. Turn the option off to keep every value as a string.
Does it support line breaks inside a quoted CSV field?
Yes. The parser reads the file as a single character stream and tracks whether it is inside a quoted field, so a real newline inside quotes is preserved as part of that value rather than splitting the record. This is the behaviour RFC 4180 specifies. Commas, custom delimiters and escaped double quotes inside quoted fields are handled correctly too.
What happens if two columns have the same header name?
JSON object keys must be unique, so the converter renames the repeat instead of dropping it. A second column named "id" becomes "id_2", a third becomes "id_3", and a notice tells you the rename happened. No column is silently lost. Rename the headers in your source data if you want different names.
Can it convert semicolon or tab delimited files?
Yes. The delimiter is auto-detected from the header row by default, covering comma, semicolon, tab and pipe, and you can also set it explicitly or enter a custom character. Semicolon files are common because Excel in many European locales uses a semicolon as its list separator; tab separated (.tsv) files work the same way.
Can I produce nested JSON instead of flat objects?
Yes. Enable "Expand nested keys" and a header such as user.name becomes a nested object {"user":{"name":...}}, while a numeric segment such as items.0.id rebuilds a real array. The separator defaults to a dot and can be changed. This is the exact inverse of the flattening performed by the JSON to CSV tool, so data can round-trip between the two.
Can I export NDJSON instead of a JSON array?
Yes. Choose NDJSON as the output format and each record is written on its own line with no wrapping array. This is the format expected by tools such as jq, BigQuery, Elasticsearch bulk import and many log pipelines. Minified single-line JSON is also available.