How-to guide

How to Convert CSV to JSON

To convert CSV to JSON, paste the CSV into a converter, confirm the delimiter and whether the first row is a header, then run it. Each remaining row becomes a JSON object keyed by the header names. Watch for quoted fields containing commas, and decide whether numeric-looking values should stay strings or be converted to numbers.

CSV to JSON Converter

Turn CSV rows into a clean JSON array of objects.

Open the tool

CSV is the format every system exports and no two systems agree on. The delimiter may be a comma, a semicolon or a tab; fields may or may not be quoted; a header row may or may not be present. Converting to JSON means making those three decisions explicitly rather than hoping a parser guesses correctly.

The one that catches people is quoting. A field containing a comma must be wrapped in quotes, and a naive split on commas will tear it in half. Any converter worth using implements RFC 4180 quoting rather than splitting on the delimiter.

Step by step

  1. Paste or upload the CSV

    Include the header row if the file has one. Keep the file intact rather than pasting a fragment, so quoting and row structure stay consistent.

  2. Set the delimiter

    Comma is the default. Choose semicolon for exports produced in locales where the comma is a decimal separator, or tab for TSV data. Getting this wrong produces one giant column.

  3. Confirm the header setting

    With headers on, the first row becomes the object keys. With it off, the converter generates positional keys such as column_1, and the first row is treated as data rather than being silently consumed.

  4. Decide on type conversion

    Type conversion turns "42" into 42 and "true" into a boolean. Leave it off for identifiers, postcodes, phone numbers and product codes, where a leading zero is meaningful and must stay a string.

  5. Check the first object

    Look at the first record in the output before trusting the rest. Almost every conversion problem — wrong delimiter, off-by-one headers, a stray byte-order mark on the first key — is visible in record one.

  6. Copy or download

    Copy the array for pasting into code, or download it as .json when it is large enough that the clipboard becomes unwieldy.

Example

Note the quoted field containing a comma: it stays a single value.

CSV

id,name,city
1,"Smith, John",Leeds
2,Ada Lovelace,London

JSON

[
  {
    "id": "1",
    "name": "Smith, John",
    "city": "Leeds"
  },
  {
    "id": "2",
    "name": "Ada Lovelace",
    "city": "London"
  }
]

Frequently asked questions

What happens to commas inside a field?
Nothing, provided the field is quoted. The converter follows RFC 4180 quoting rules, so "Smith, John" is read as one value. Escaped double quotes ("") and newlines inside quoted fields are handled the same way.
Why did my leading zeros disappear?
Either type conversion turned the value into a number, or the spreadsheet stripped them before you exported. Turn type conversion off to keep postcodes, phone numbers and product codes as strings.
My whole file became one column. Why?
The delimiter is wrong. Semicolon-delimited exports are common in European locales and will parse as a single column if the converter is set to comma. Change the delimiter and run it again.
What if rows have different numbers of fields?
Ragged rows are handled rather than rejected: missing trailing fields become empty, and extra fields beyond the header are kept under generated keys so no data is silently dropped.
Is my data uploaded?
No. Conversion runs in your browser. This matters for CSV in particular, because spreadsheet exports so often contain customer names, email addresses and internal figures.

Tools used in this guide

All tools →
All guides →

Last reviewed .