CSV to JSON Converter

Convert CSV to JSON in seconds: paste a CSV or upload a .csv file, and this free CSV to JSON converter turns each row into a JSON object using the header row as keys. It detects the delimiter and number types for you.

⇄ JSON to CSV
Paste CSV, upload a file or press Sample. It converts as you type.

Private by design: the conversion runs in your browser and nothing is uploaded or saved. Only your option choices are remembered on this device.

How to convert CSV to JSON

  1. Paste the CSV, drop a .csv or .tsv file onto the input, or press Upload. Sample loads an example.
  2. Leave First row is the header ticked if the first line holds column names. The JSON updates as you type.
  3. Choose Array of objects (one object per row) or Array of arrays, and the JSON indentation.
  4. Press Copy or Download .json. To check or tidy the result further, format and validate the JSON, or browse it in the JSON viewer.

CSV to JSON example

A small product list, with a quoted name that contains a comma:

sku,name,price,in_stock,discontinued
A-100,"Desk, oak",129.5,true,null
A-101,Lamp,19,false,
A-102,Chair,007,true,false

becomes an array of objects, one per row, keyed by the header:

[
  {
    "sku": "A-100",
    "name": "Desk, oak",
    "price": 129.5,
    "in_stock": true,
    "discontinued": null
  },
  {
    "sku": "A-101",
    "name": "Lamp",
    "price": 19,
    "in_stock": false,
    "discontinued": ""
  },
  {
    "sku": "A-102",
    "name": "Chair",
    "price": "007",
    "in_stock": true,
    "discontinued": false
  }
]

Notice what happened to the values: 129.5 and 19 became numbers, true/false became booleans, null became JSON null, the empty cell stayed "", and 007 stayed a string so the leading zeros survive.

Numbers, true/false and null

CSV has no types: every cell is text. With Detect numbers, true/false, null ticked, the converter types only the values that are safe to convert:

  • Plain numbers like 42, -3.5 and 1e6 become JSON numbers.
  • true/false (also TRUE, False) become booleans, and null becomes null.
  • Leading zeros, +1, 1,000, dates and integers above 9,007,199,254,740,991 stay strings.

Untick it to keep every value as a string, which is what some importers expect:

[
  {
    "sku": "A-100",
    "price": "129.5",
    "in_stock": "true"
  }
]

Commas, semicolons and tabs

The delimiter is detected automatically (comma, semicolon, tab or pipe). Many European spreadsheets save semicolon-separated files with a decimal comma, which stays text rather than being misread:

[
  {
    "name": "Desk, oak",
    "price": "129,50"
  },
  {
    "name": "Lamp",
    "price": 19
  }
]

Quotes, line breaks and messy CSV

The parser follows RFC 4180: a field in double quotes can contain commas, line breaks and doubled quotes (""). This CSV

id,comment
1,"She said ""ship it""
then left"

converts to

[
  {
    "id": 1,
    "comment": "She said \"ship it\"\nthen left"
  }
]

It also copes with the usual problems in exported files:

  • A byte order mark at the start (common in Excel exports) is removed, so the first key isn't "id".
  • Blank lines are skipped.
  • Uneven rows are padded or given extra keys, with a warning.
  • A quote that is never closed stops the conversion and shows where it starts. For example: A quoted field is never closed: a " opens a field but no matching " ends it. (line 2, column 3). Press Show in input to jump to it.

Array of objects or array of arrays?

Array of objects is easiest to work with in code, because you read values by name (row.price). Array of arrays is smaller and keeps the header as the first row, which suits charting libraries and bulk inserts:

[["sku","price"],["A-100",129.5],["A-101",19]]

Convert CSV to JSON in Python or JavaScript

  • Python: json.dump(list(csv.DictReader(open("in.csv", newline="", encoding="utf-8-sig"))), open("out.json", "w"), indent=2). Every value stays a string, so convert types yourself.
  • JavaScript: Papa.parse(text, { header: true, dynamicTyping: true, skipEmptyLines: true }).data with the Papa Parse library, which this tool also uses for parsing. Note that dynamicTyping turns 007 into 7.

Need the reverse? The JSON to CSV converter turns JSON back into a spreadsheet-ready CSV.

Frequently asked questions

How do I convert CSV to JSON?

Paste the CSV into the left box or upload the .csv file. With "First row is the header" ticked, each following row becomes a JSON object whose keys are the header names. Copy the JSON or download it as a .json file.

What if my CSV has no header row?

Untick "First row is the header". Every row is then converted, and the keys are named column1, column2 and so on. Or choose "Array of arrays" to get each row as a plain list of values.

Why is a value like 007 still a string in the JSON?

Numbers with leading zeros, plus signs or thousands separators (007, +1, 1,000) are kept as text so nothing is lost: ZIP codes, phone numbers and IDs would be damaged if 007 became 7. Integers too large for JavaScript to hold exactly also stay strings.

How are empty cells converted?

An empty cell becomes an empty string (""). Only the literal word null (or NULL) becomes JSON null, so you can tell an empty value from a missing one.

Can I convert an Excel file to JSON?

Save the sheet from Excel as "CSV UTF-8 (Comma delimited)" first, then upload that file here. Excel files in .xlsx format are zipped workbooks, not text, so they need that export step.

My CSV uses semicolons or tabs. Does that work?

Yes. Delimiter "Auto-detect" checks commas, semicolons, tabs and pipes and tells you which one it used. If it guesses wrong, choose the delimiter yourself.

What happens to rows with too many or too few fields?

Missing fields become empty strings and extra fields get keys like column5, and the status line warns how many rows were uneven, so you can check the source file.

Why were some of my headers renamed?

JSON objects cannot have two keys with the same name, so a repeated header gets a number (name, name_2), and an empty header becomes column1, column2 and so on, by position.

Is my CSV uploaded anywhere?

No. The file is read and converted by your own browser, and nothing is sent to a server or saved. Only option choices such as the delimiter are remembered on your device.

This converter is provided as is. Check the JSON before you rely on it, especially IDs, dates and very large numbers. Spotted a wrong result? Tell us. Last reviewed .