CSV to JSON: the complete guide
Everything you need to know about the CSV format, the JSON output shape, and how to handle real-world edge cases.
What shape is the output?
By default, a CSV to JSON converter produces a JSON array of objects. The first row of your CSV (or the first row you mark as the header) becomes the keys; each subsequent row becomes one object in the array. This is the shape that JSON.parse in JavaScript, json.load in Python, and JSONArray in Java all expect.
If you want a single object instead of an array — useful when your CSV has only one meaningful record — open the settings and switch to "Single object (key = first column, value = rest)". This is rare but supported.
You can also choose the indent style. Pretty-printed output uses 2 spaces and is easy to read; minified output is a single line and is what you want for production use or network transfer.
How are types inferred?
CSV has no native types — every cell is text. But the converter examines each value and emits the most appropriate JSON type:
- Numbers: Any value matching the regex
/^-?\d+(\.\d+)?$/(integers and decimals, including negative) is emitted as a JSON number. Scientific notation (1.5e10) is also supported. - Booleans:
true,false,TRUE,FALSE,Yes,No(case-insensitive) become JSON booleans. - Null: Empty cells and the literal string
null,NULL, orN/Abecome JSONnull. - Everything else: Strings. If the value contains a comma, quote, or newline, it is wrapped in JSON double quotes (escaping inner quotes as
\").
If you'd rather treat all values as strings (e.g., zip codes that look like numbers, IDs that look like booleans), open settings and disable type inference.
How does quoting work?
CSV quoting is the source of most parser bugs in the wild. The converter implements RFC 4180 strictly, which means:
- Any field may be wrapped in double quotes.
"hello, world"is one field, not two. - Embedded double quotes are escaped by doubling them:
"she said ""hi"""is a field whose value isshe said "hi". - Newlines inside quoted fields are preserved, not treated as row terminators.
- Unquoted fields stop at the delimiter (or the end of the line).
Files exported from Excel, Google Sheets, Numbers, and most databases all follow these rules. Files exported from some homegrown tools don't — if your input has weird quoting, you'll see an explicit error message rather than silent data corruption.
Which delimiter should I use?
The "right" delimiter depends on where your CSV came from:
- Comma (default): Standard CSV. Used by most US exports, RFC 4180 examples, and most APIs.
- Tab: Common for database exports and Excel paste operations. Avoids the comma-in-value problem entirely.
- Semicolon: Default in many European locales, where the decimal separator is a comma and CSV would otherwise be ambiguous.
- Pipe: Used by some log formats and pipe-separated value (PSV) tools. Useful when your data contains all the other common delimiters.
The auto-detect option sniffs the first line and picks the most likely delimiter based on which character appears most consistently as a separator. It works for >95% of real-world files. For trickier cases, set the delimiter manually in settings.
How are headers handled?
By default, the first row of your CSV is treated as the header — the names used as JSON keys. This matches what every spreadsheet program does on export.
If your file does not have a header row (some database dumps don't), open settings and either:
- Turn on "Auto-generate columns" — the converter will use
col1,col2,col3as the keys. - Enter custom column names — one per line in the settings panel.
You can also strip whitespace from header names and lowercase them with one toggle — useful when you're feeding the output into a JavaScript app that uses camelCase keys.
Common edge cases
Real-world CSV is rarely as clean as the textbook example. Here are the most common gotchas and how to handle them:
- UTF-8 BOM: The byte-order mark (the invisible
\ufeffat the start of files saved by Excel on Windows) is automatically detected and stripped. - Trailing empty rows: Common in Excel exports. Empty lines at the end of the file are ignored.
- Embedded newlines: Supported via quoting. A field can contain a real newline if it's wrapped in double quotes.
- Mixed line endings: Both CRLF (Windows) and LF (Unix) line endings parse correctly, even in the same file.
- Different number of columns per row: The header row's column count is authoritative. Rows with fewer columns are padded; rows with more have extras dropped (with a warning in the result panel).
- Duplicate column names: Auto-disambiguated as
name,name_2,name_3. - Empty file or only headers: Returns an empty array
[], not an error.
Performance and limits
Because conversion runs entirely in your browser, the practical limit is your tab's available memory — typically 200 MB to 2 GB depending on the browser and device. A 50 MB CSV is a few-second conversion; a 200 MB CSV is borderline.
For very large files, the bottleneck is usually memory, not CPU. Close other tabs, use a 64-bit browser (Chrome, Edge, Firefox all qualify), and avoid running on a low-RAM device. The converter streams the file in chunks rather than loading the whole thing at once, so it stays responsive even on large inputs.
Frequently asked questions
What is a CSV to JSON converter?
Is CSV to JSON conversion free?
Does the first row need to be a header?
How are quoted values handled?
What about large files?
Try the converter
Paste your CSV, get a clean JSON array ready for any API or app.