"category": "format-converter",

CSV to JSON Converter

"tldr": Paste CSV with a header row and get a typed JSON array of objects - numbers and booleans detected automatically, all in your browser.

Turn CSV data into a JSON array of objects. The first row of your CSV becomes the object keys, and every following row becomes one JSON object. Quoted fields, embedded commas, and multi-line values are parsed according to the CSV standard (RFC 4180).

{"csv": "json"}

Values that look like numbers, booleans, or null are converted to real JSON types automatically - "42" becomes 42 and "true" becomes true - so the output is ready to use in your application without post-processing. All parsing happens in your browser; your data never leaves your machine.

How to convert CSV to JSON

  1. 1Paste your CSV into the input panel - the first row must be the column headers.
  2. 2Each subsequent row is converted into a JSON object keyed by those headers.
  3. 3Numbers, booleans, and null are detected and typed automatically; everything else stays a string.
  4. 4Copy the JSON output or download it as a .json file.

Convert CSV to JSON in code

Python
import csv, json

with open("data.csv", newline="") as f:
    rows = list(csv.DictReader(f))

print(json.dumps(rows, indent=2))
JavaScript (Node.js)
const [header, ...lines] = csvString.trim().split("\n");
const keys = header.split(",");
const json = lines.map(line => {
  const values = line.split(",");
  return Object.fromEntries(keys.map((k, i) => [k, values[i]]));
});

Frequently asked questions

Does my CSV need a header row?

Yes. The first row is used as the JSON object keys. If your file has no headers, add a row like "col1,col2,col3" at the top before converting.

How are commas inside values handled?

Fields wrapped in double quotes are parsed per the CSV standard, so "Smith, John" stays one value. Escaped quotes ("") inside quoted fields are also handled correctly.

Why did my ZIP codes turn into numbers?

The converter detects numeric-looking values and types them as JSON numbers, which strips leading zeros from values like 02134. If you need them preserved as strings, wrap those CSV values in quotes with a non-numeric character, or fix the type after conversion.

Can I convert Excel files with this tool?

Indirectly, yes. In Excel or Google Sheets, use File → Save As / Download → CSV, then paste that CSV here. The result is a JSON array with one object per spreadsheet row.

Last updated:

You might also need

Free and in-browser, like everything on JSON Console. Browse all tools →