Features
- Handles quoted fieldsCommas, quotes and line breaks inside quoted values are read correctly.
- Safe typesValues stay text unless you ask for numbers and booleans, and leading zeros are never lost.
- Runs on your deviceYour data is processed in the browser and is never uploaded.
How to use the CSV to JSON converter
- Paste CSV or open a .csv file.
- Tick Convert numbers and booleans if you want typed values.
- Copy or download the JSON.
What makes CSV tricky
A field containing a comma, quote or newline must be wrapped in double quotes, and a quote inside it is written twice. Splitting each line on commas breaks on such data.
Convert CSV to JSON in JavaScript
// Simple files only: no quoted commas or line breaks
const [head, ...rows] = csv.trim().split('\n').map((line) => line.split(','));
const json = rows.map((row) => Object.fromEntries(head.map((key, i) => [key, row[i]])));
Frequently asked questions
Is the first row required?
Yes. It supplies the property names.
What happens to duplicate headers?
Later ones get a suffix such as name_2.
Can it read semicolon-separated files?
Not here. The CSV viewer detects semicolons; this converter expects commas.