How to use
- Paste CSV, with or without a header row.
- Pick the Field separator if it is not a comma (semicolon and tab are common exports from European Excel and TSV files).
- Leave First row is a header on to get an array of objects; untick it for an array of arrays.
- Detect numbers, booleans and blanks turns
"28"into28and an empty cell intonull; untick it to keep every value as text. - Copy to clipboard, or Download .json.
Why a real parser instead of splitting on commas
CSV looks simple enough to parse with line.split(',') until a field itself contains a comma: a full name like "Hopper, Grace", an address, or a quoted number with a thousands separator. RFC 4180 handles this by allowing a field to be wrapped in double quotes, inside which a comma, a line break, or an escaped "" are all just part of the value. A naive split breaks on all three.
This tool implements that quoting rule directly (not a regular expression, which cannot correctly track "am I inside quotes right now" across a comma or a newline) and turns each row into a JSON object keyed by the header, or a plain array if your CSV has no header row. Going the other way, the JSON to CSV Converter turns a JSON array back into a spreadsheet-ready file.
Example
This CSV, including a value that itself contains a comma:
name,age,city
Ada Lovelace,28,London
"Grace Hopper, PhD",85,"New York, NY"becomes:
[
{
"name": "Ada Lovelace",
"age": 28,
"city": "London"
},
{
"name": "Grace Hopper, PhD",
"age": 85,
"city": "New York, NY"
}
]Options explained
- Field separator: Comma / Semicolon / Tab. Semicolon is common in CSV exported by Excel in European locales that use a comma as the decimal separator; tab is a plain TSV file.
- First row is a header: on, each row becomes an object keyed by the header row; off, each row becomes a plain array in column order.
- Detect numbers, booleans and blanks, when on, turns a cell that looks like a whole number or decimal into a JSON number,
true/falseinto booleans, and an empty cell intonull; when off, every cell stays a JSON string exactly as written. - Indent: 2 spaces / 4 spaces / Minified sets the output layout, the same as the JSON Formatter.
Edge cases and common errors
- No content at all stops with "Paste CSV to convert" rather than returning an empty array silently.
- Ragged rows are handled, not rejected. A row with fewer cells than the header fills the missing ones with
null(or an empty string, with type detection off); a row with more cells than the header has the extra ones dropped.a,b,cwith rows of 2 and 4 cells becomes[{"a":1,"b":2,"c":null},{"a":1,"b":2,"c":3}]. - Duplicate column names: see the FAQ.
- Leading-zero numbers are kept as text. See the FAQ; this is a deliberate choice, not a limitation of the number detection.
- Blank lines are skipped, including a trailing blank line from a file that ends with a newline; they do not become an empty object or an empty array in the output.
- Integers above 253 lose precision, the same JavaScript-number caveat as every other JSON tool on this site: store very large IDs as quoted text (untick type detection, or quote the value in the CSV) if every digit matters.
Do the same thing in code
import csv, json
with open("data.csv", newline="") as f:
rows = list(csv.DictReader(f))
print(json.dumps(rows, indent=2))Python's csv module handles the same RFC 4180 quoting rules but keeps every value as a string, and you would add your own number/boolean conversion to match this tool's "Detect numbers, booleans and blanks" option. In the browser, the closest widely-used equivalent is the PapaParse library.