🔄 CSV to JSON Converter
Convert CSV to JSON in your browser, with control over type inference so leading zeros survive. Covers the Excel BOM and semicolon-delimiter traps.
What CSV to JSON Converter Does
CSV looks simple and is not. There is no binding standard — RFC 4180 is an informational memo describing common practice, and real files violate it routinely. Converting to JSON forces every ambiguity in a CSV file to be resolved, which is why conversion is where data quietly breaks.
The two hard problems are quoting and typing. Quoting decides where a field ends when the field itself contains a comma, a quote or a newline. Typing decides whether the text 007 becomes the string "007" or the number 7 — and if it is a product code, that conversion has destroyed it.
This converter parses quoted fields, handles embedded delimiters and newlines, and lets you control type inference. The sections below cover what to check before trusting any CSV conversion, including yours.
How to Use CSV to JSON Converter
- Paste your CSV text or JSON array in the input box
- Choose whether to convert CSV to JSON or JSON to CSV
- Click Convert to generate the formatted output
- Click Copy Output to paste into your code editor or workflow
Type Inference Hazards
What naive numeric conversion does to values that look like numbers but are not. Verified against the JavaScript engine.
| CSV value | Becomes | Why it matters |
|---|---|---|
| 007 | 7 | Product codes, US ZIP codes and account numbers lose leading zeros permanently |
| 0123 | 123 | Same problem; the original cannot be recovered |
| 1e5 | 100000 | A gene name, part number or ID read as scientific notation |
| +1 | 1 | A phone country code becomes the number one |
| 1,234 | NaN or "1,234" | Thousands separators are not numbers |
| TRUE | string or boolean | Depends entirely on the parser |
| 2026-09-06 | string | JSON has no date type; it stays text |
Quoting Rules (RFC 4180)
| Situation | Correct CSV | Resulting value |
|---|---|---|
| Field contains a comma | "Smith, John" | Smith, John |
| Field contains a quote | "He said ""hi""" | He said "hi" |
| Field contains a newline | "line one⏎line two" | A single field with a line break |
| Empty field | a,,c | The middle value is an empty string |
| Field with leading spaces | " padded" | Spaces inside quotes are significant |
Source: RFC 4180 — Common Format and MIME Type for CSV Files
Why a File That Looks Fine Fails
| Cause | Symptom | Fix |
|---|---|---|
| UTF-8 BOM from Excel | First column name has an invisible prefix, so row.name is undefined | Strip the BOM before parsing the header |
| Semicolon delimiter | Every row becomes one field | European Excel uses ; when the decimal separator is a comma |
| CRLF vs LF | Trailing \r on the last field of every row | Normalize line endings first |
| Duplicate column names | One column silently overwrites the other | JSON object keys must be unique — rename first |
| Ragged rows | Some objects missing keys, or extra values dropped | Rows must have the same field count as the header |
| Mixed encodings | Accented characters become mojibake | Confirm the file is UTF-8, not Latin-1 |
How to Read Your Result
The BOM is the bug you cannot see
Excel writes a UTF-8 byte order mark at the start of the file. A naive parser makes the first header "\uFEFFname" rather than "name", so every lookup on that column returns undefined while the data looks perfect in the output. This is one of the most time-consuming CSV bugs precisely because the character is invisible. Strip a leading U+FEFF before splitting the header row.
Turn type inference off for identifiers
Any column that is an identifier rather than a quantity — SKU, ZIP code, phone number, account reference — should stay a string. The damage from converting "007" to 7 is irreversible once the original file is gone, and it usually surfaces weeks later when a join stops matching.
Semicolons are not a broken file
In locales where the comma is the decimal separator, Excel exports semicolon-delimited files and still calls them CSV. If every row parses as a single field, check the delimiter before concluding the file is corrupt.
JSON arrays versus newline-delimited JSON
A single JSON array is convenient for small data and awkward for large data, because the whole document must be parsed at once. NDJSON — one JSON object per line — streams and appends, which is why log pipelines and data warehouses prefer it. For a large export, NDJSON is usually the better target.
Limitations & Accuracy Notes
- Conversion runs in your browser, so file size is bounded by available memory. Multi-hundred-megabyte files need a streaming parser rather than a web page.
- CSV has no standard for representing null. An empty field could mean empty string, null or missing, and the converter has to pick one — check which convention your consumer expects.
- Column order is preserved in the output, but JSON objects are formally unordered and a consumer is free to ignore it.
- Nested JSON cannot be inferred from a flat CSV without a naming convention for the headers. This converter produces flat objects.
- Very large integers beyond ±(2^53 − 1) lose precision if converted to numbers, exactly as they do anywhere else in JSON. Keep long IDs as strings.
Frequently Asked Questions
How does CSV to JSON conversion work?
Is my data private and secure?
How are commas inside a field handled?
What happens to the header row?
Are numbers converted to JSON numbers or left as strings?
Is my file uploaded?
Does it handle semicolon-separated files?
Why do some rows have missing keys?
References & Further Reading
- RFC 4180 — Common Format and MIME Type for Comma-Separated Values (CSV) Files — The informational memo describing common CSV practice, including the quoting rules
- RFC 8259 — The JSON Data Interchange Format — The target format, and why it has no date or integer type