CSV to JSON Converter
A parser that honours RFC 4180 quoting, so quoted commas and embedded newlines survive.
Why hand-written CSV parsers fail
Splitting on commas works until the first field contains one. A real parser is a small state machine that tracks whether it is inside a quoted field, because inside quotes a comma is data, a newline does not end the record, and "" means one literal double quote. The test case that catches nearly every naive implementation is a field holding an address: "123 Main St, Apt 4" must produce one cell, not two.
With and without a header row
- With headers — the first row names the keys, and each subsequent row becomes an object. Missing trailing cells are filled as empty strings, and blank header cells are auto-named so no column is lost.
- Without headers — every row is data and the output is an array of arrays. Selecting this mode while the file does have a header means the header becomes your first data row, which is a common and confusing mistake.
Type inference: helpful and dangerous in equal measure
CSV carries no types, so a converter must guess. This tool converts a cell to a number when it looks strictly numeric, and leaves it as a string otherwise. Three cases are deliberately conservative because guessing wrong is worse than not guessing:
| Cell text | Result | Why |
|---|---|---|
42 | number 42 | Unambiguous |
007 | string "007" | Leading zeros mean it is an identifier, not a number |
1e3 | string "1e3" | Ambiguous — treated as text to avoid surprises |
true | boolean true | JSON has a native boolean |
2026-01-15 | string "2026-01-15" | JSON has no date type; keep it as text |
| `` (empty) | empty string | null and "" cannot be distinguished in CSV |
Delimiters, encodings and the BOM
Although the format is named after the comma, semicolon-separated files are standard in locales where the comma is the decimal separator, and TSV remains common because tab almost never appears inside a field. Files exported from Excel on Windows frequently begin with a UTF-8 byte-order mark; a parser that does not strip it produces a first key literally named \uFEFFname, which then fails to match anything downstream.
Very large files
A converter that builds one giant array in memory is bounded by tab memory. If you are working with a multi-hundred-megabyte export, convert in chunks and emit JSON Lines — one object per line — which streams and lets you process records one at a time without ever holding the whole dataset.
How to use it
- Paste the CSV or drop a file.
- Set the delimiter — comma, tab, semicolon, pipe or space.
- State whether the first row is a header.
- Convert and inspect the first few records.
Worth knowing
- RFC 4180 quoting lets a field contain commas, quotes and newlines.
- Inside a quoted field,
""represents one literal double quote. - Leading zeros are preserved as strings to protect identifiers and postal codes.
- Excel on Windows often writes a UTF-8 BOM that must be stripped.
Limitations
- Type inference is heuristic — always validate the output against your schema.
nullcannot be expressed in CSV and becomes an empty string.- Nested structure cannot be recovered; a cell holds a flat string.
- Multi-gigabyte files are better processed in chunks than in a browser tab.
Frequently asked questions
How do I handle commas inside quoted fields?
What happens to my header row?
Why is a number coming out as a string?
007 and postal codes must stay strings or they lose information.