CSV to JSON Converter
Convert CSV data to JSON format instantly. Paste or upload your CSV file.
Upload a CSV or TXT file (max 5MB)
Conversion Options
How to Use:
- Paste your CSV data in the left textarea or upload a CSV file
- Configure conversion options (headers, delimiter, output format, etc.)
- Click "Convert to JSON" to transform your CSV
- Copy the JSON output or download it as a file
- Use "Format JSON" or "Minify JSON" to adjust the output
How the CSV Parser Actually Handles Edge Cases
This isn't a naive split(",") converter โ it walks the input character by character and tracks quote state, so a field like "Smith, John" stays one field instead of splitting into two at the internal comma. Doubled quotes inside a quoted field ("She said ""hi""") are correctly unescaped to a single ". Newlines inside an open quote are also preserved rather than treated as row breaks, so a quoted multi-line address field won't get chopped into extra rows.
One behavior worth knowing before you rely on this for anything precise: every field is .trim()'d after parsing, including the contents of quoted fields. If a quoted CSV value intentionally has leading or trailing spaces, they will be silently removed. Also, rows where every field ends up empty (e.g. a blank separator line in the source file) are dropped entirely rather than turned into an empty object.
Automatic Type Detection โ and Where It Bites You
Every CSV cell is a string, but this converter tries to guess a more useful JSON type per value: "true"/"false" (case-insensitive) become JSON booleans, "null" becomes JSON null, and anything that parses as a number via parseFloat becomes a JSON number. This is convenient for numeric columns, but it has a well-known failure mode: leading-zero identifiers get corrupted. A ZIP code column containing 00501 or a product SKU like 007734 will convert to the bare number 501 or 7734, silently dropping the leading zeros. If your data has ZIP codes, phone extensions, or ID codes with leading zeros, expect this and re-quote or post-process those columns as strings after conversion if the leading zeros matter.
Known limitation with the Tab delimiter option: the delimiter dropdown's "Tab" choice is compared against a literal tab character internally. If selecting Tab doesn't split your pasted data into separate fields the way you expect, it's most reliable to re-save the source as comma- or pipe-delimited (most spreadsheet apps offer this as an export option) rather than relying on the Tab setting for a genuine TSV export.
Header Sanitization and Output Shape
When "First Row as Column Headers" is on, each header string is sanitized into a valid JSON-friendly key before it's used: spaces become underscores, characters outside A-Z a-z 0-9 _ - are stripped, and a header starting with a digit gets an underscore prefixed (so 2024 Revenue becomes _2024_Revenue). Turn the option off and the tool falls back to generic column1, column2... keys instead โ useful for headerless exports from older database tools.
"Output as Array of Objects" produces a plain JSON array ([{...},{...}]), which is what most REST APIs and JavaScript fetch() consumers expect. Turning that off instead wraps the same array under a custom key you name yourself (the "Root Element" field), producing {"data": [...]}-shaped output โ handy when the receiving system expects a named top-level property rather than a bare array.
Frequently Asked Questions
Why did my ZIP codes or ID numbers lose their leading zeros?
The converter auto-detects numeric-looking strings and outputs them as JSON numbers, and JSON numbers can't carry leading zeros. If leading zeros matter, treat that column specially after export, or avoid relying on auto type detection for identifier-like columns.
A field with a comma inside quotes got split incorrectly โ why?
The parser does track quote state correctly for standard "quoted, field" CSV, so this is usually a sign the field wasn't actually quoted in the source, or used mismatched/unescaped quotes. Re-export the CSV making sure fields containing your delimiter are wrapped in double quotes.
Did my blank rows just disappear?
Yes, intentionally โ any row where every field is empty (common with trailing blank lines in exported files) is skipped rather than turned into an empty JSON object.
My header had spaces and symbols โ what key did it become?
Spaces are converted to underscores and other special characters are stripped, so Order # becomes Order_ and First Name becomes First_Name. Rename ambiguous headers in your source CSV first if you need specific JSON key names.
Should I output an array or a named root object?
Use the array format (default) if you're feeding the JSON straight into a REST API body or a JavaScript array method. Use a named root element if the consuming system parses top-level JSON objects and expects a specific property name to hold the list.
