CSV to JSON, How to Convert Cleanly, Delimiters, Headers and Quoting
CSV looks like a simple split on commas, and that is exactly why conversions go wrong. A real CSV parser must honour quoted fields, which may contain commas, newlines and escaped quotes, respect the actual delimiter, decide whether the first row is headers or data, and choose how to type values. Get any of those wrong and the JSON looks fine but is quietly corrupted.
The CSV to JSON converter turns your text into an array of objects, with a custom delimiter, a header option, optional type inference that detects numbers and booleans without destroying leading-zero identifiers, a live syntax-highlighted preview, compact-output toggle, CSV re-export, and copy or download, all in your browser, so your data never leaves the page. This guide covers the decisions that make a conversion correct, and the traps that make one wrong.
The shape decision, objects or arrays
A CSV file is a 2D table. JSON gives you two reasonable shapes. If the first row holds column names, treating it as headers yields an array of objects keyed by those names, the friendly form for APIs. If there is no header row, each record is an array of positional values. Choosing wrong is the most common error. "header on" when your real first data row is a name like "Alice,30" silently throws away Alice.
The rule is simple, only tick the header option if the top row is genuinely labels, not data. The converter lets you flip it and see the preview change, so verify against the first record.
Quoting and the fields CSV actually must handle
Commas are not always separators. In valid CSV, a field wrapped in double quotes can contain the delimiter, newlines and even other quotes. "12 Main St, Apt 4",40 is one address cell and one age, not three columns. Doubled "" inside a quoted field means a literal quote. A naive splitter that just cuts on commas shatters these rows.
Also watch for a leading BOM, a byte-order mark Excel adds, that can sneak invisible characters into your first header, and for blank cells, which should become empty values rather than being skipped.
The delimiter is not always a comma
Many locales export CSV separated by semicolons, and some spreadsheet apps use tabs, the file is still "a CSV" by habit. Converting a semicolon-separated file on comma assumption produces one giant column. That is why the converter exposes a custom delimiter. Match it to what the file truly uses, comma, semicolon, or tab, and confirm the preview splits into the right number of fields.
Data types, why auto-conversion is dangerous
CSV has no types, every value is text. When you convert to JSON you face a choice. Keep everything a string, or try to infer numbers and booleans. Inference looks helpful but corrupts real data. A US zip code 00501 becomes number 501, leading zeros gone, a 16-digit account or an ID loses precision beyond JavaScript's safe integer range, and N may flip to false. Values used as identifiers should stay strings.
The safe default is. Treat CSV cells as strings, and only coerce a specific column to a number where you are certain it is purely numeric and never an identifier. Never let a blind auto-typer decide for you.
| If the column is. | Safest JSON type | Why |
|---|---|---|
| an id, zip, phone, ISIN | string | Leading zeros and precision must survive. |
| a genuine measurement | number, if clean | Enables maths, but only if never identifier-like. |
| a code like S, M, XL | string | A single letter must not become a boolean. |
| a date | string | Format ambiguity, parse later, deliberately. |
| anything ambiguous | string | Strings are lossless. Convert on purpose, not by accident. |
Keeping strings is reversible. Losing a leading zero is not. When in doubt, stay textual and type individual fields yourself after the conversion.
A careful conversion workflow
Paste the raw CSV, set the delimiter to what the file actually uses, and toggle the header option only if the top row is labels. Read the live preview and sanity-check the first and last records and any row with quoted commas. Only then copy or download the JSON. Because it runs locally, nothing is uploaded, so you can safely process files you would not send to a random web service.
For the reverse direction, the converter's CSV re-export button turns parsed JSON back into properly quoted spreadsheet text without leaving the page. To reach yet another format, the JSON to XML and XML to JSON converters pair with this one, and the JSON formatter prettifies and validates the result before you consume it.
Frequently Asked Questions
Why is my CSV becoming one huge column?
Your delimiter is wrong for the file. Semicolon- and tab-separated exports are common, especially from non-US spreadsheets. Set the custom delimiter to match the actual separator and check that the preview splits into the expected number of fields.
Should I tick the header option?
Only if the first row is real column names. Ticking it when the top row is data discards that row as keys, and leaving it off when there are headers loses the readable keys. Flip it and read the first record in the preview to confirm.
Why did my zip code lose its leading zeros?
Something coerced it to a number. ZIPs, phone numbers, ids and account numbers must stay strings, because 00501 as a number is 501. Treat CSV cells as text by default and only convert genuinely numeric columns on purpose.
Can a CSV field contain a comma or a newline?
Yes, when the field is wrapped in double quotes, a quoted cell may include commas, line breaks and escaped quotes, written as a doubled ". A correct parser honours the quoting. A naive split-on-comma does not and will corrupt the row.
What is a BOM and why does it matter?
A byte-order mark is an invisible character some tools prepend. It can attach to your very first header name, so a key that looks like name is really name. Strip the BOM, or the first column name will not match what your code expects.
Does my data get uploaded during conversion?
No. The converter runs entirely in your browser, so the CSV you paste stays on your device and the JSON is produced and copied locally. That is both a privacy benefit and a reason you can process sensitive exports safely.