CSV to JSON
Paste or upload a CSV file to turn its rows into a JSON array. Runs in your browser.
Pasted text and chosen files stay on this device. Nothing is sent to a server.
Drop a file here, choose one, or paste.
How to use it
- 1
Paste the CSV.
- 2
Read the column types before using the output — that is where a silent type mistake would show up.
What it does
CSV has no types. Every cell is text, so the conversion has to decide which columns are numbers, which are booleans and which are genuinely text — and that decision is the whole job.
Parse the CSV (quoted fields, embedded commas and newlines), use the first row as keys, and infer a type per column. Report rows read, columns, and each column's inferred type.
Why it works this way
A column is typed by all of its values, not the first. Inferring from row one makes a column of mostly numbers become a string because the first cell was blank or quoted, and nothing about the output says so.
Leading zeros and long digit strings are the trap. A postcode or an account number that parses as a number loses its leading zero, so digits-only columns with leading zeros stay strings and the column report says why.
The parser handles quoted fields containing commas and newlines. A conversion that splits on commas breaks on the first quoted address and produces plausible wrong rows.
Examples
a,b\n1,2
[{"a":1,"b":2}]zip\n01234
[{"zip":"01234"}]Inputs and outputs
- CSV text
- header row: first row / none
- type inference: on / all strings
- JSON array of objects
- rows and columns
- the inferred type of each column
Edge cases
- quoted fields containing commas
- embedded newlines inside quotes
- leading zeros
- an empty cell — null or empty string, and the column report distinguishes them
- duplicate header names
- a ragged row shorter than the header
Frequently asked questions
Why is my number column a string?
If any cell in the column has a leading zero, is blank, or is quoted, the column is text. The column report names the reason.
Does it handle commas inside values?
Yes, when the field is quoted, which is what CSV requires for that case.
Related tools
Sources
- RFC 4180, Common Format and MIME Type for CSV Files