DataSwitch Pro Private, in-browser data converter

CSV to JSON Converter

Turn CSV rows into a clean JSON array — free, instant, and processed entirely in your browser.

Copied to clipboard!
Rows
0
Columns
0
Delimiter
—
Input Size
0 B
Output Size
0 B
Speed
0 ms

How to convert CSV to JSON

Updated · 3 min read

CSV is the format spreadsheets and databases export; JSON is the format APIs, JavaScript and most modern applications expect. This converter turns each row of a CSV file into a JSON object, using the header row for the property names. It runs in your browser, so you can safely convert exports that contain customer or financial data.

  1. Paste your CSV into the input box, or drag a .csv file onto it.
  2. Check that the first row contains your column names — it becomes the JSON keys.
  3. If the output looks wrong, set the Input delimiter in Options (comma, semicolon, tab or pipe).
  4. Choose the JSON indentation, then click Copy or Download.

Example

CSV input

id,name,city,zip,active
1,"Doe, Jane",Boston,02134,true
2,Alex Smith,Rabat,10000,false

JSON output

[
  {
    "id": 1,
    "name": "Doe, Jane",
    "city": "Boston",
    "zip": "02134",
    "active": true
  },
  {
    "id": 2,
    "name": "Alex Smith",
    "city": "Rabat",
    "zip": 10000,
    "active": false
  }
]

Notice three details: the comma inside "Doe, Jane" does not split the field, 02134 stays a string because its leading zero matters, and true/false become real JSON booleans.

Your data stays on your device. The conversion runs in JavaScript inside this tab — files and pasted text are never uploaded to DataSwitch Pro.

How the conversion works

Delimiters, Excel and encodings

Despite the name, many "comma-separated" files are not separated by commas. Excel uses the list separator of the computer's region: in France, Morocco, Germany and much of Europe that is a semicolon, because the comma is the decimal separator. Database tools often export tabs, and some legacy systems use a pipe (|). The converter inspects the first lines of your file and picks the delimiter that splits every line into the same number of fields.

Files saved by Excel as CSV UTF-8 begin with an invisible byte-order mark. Many converters leave it attached to the first header, producing a key like "\ufeffid" that breaks code which looks up id. DataSwitch Pro removes it, and files in Windows-1252 or UTF-16 are decoded automatically when uploaded.

Quotes and line breaks inside cells

The parser follows RFC 4180, the closest thing CSV has to a standard. A field wrapped in double quotes may contain commas, semicolons and even line breaks; a double quote inside such a field is written twice (""). For example "He said ""hi""" becomes the JSON string "He said \"hi\"". If a quote is never closed, the converter warns you instead of guessing.

Common problems and fixes

Convert CSV to JSON in code

For one-off files the tool above is quickest. To automate the same task in a script or pipeline, these snippets are a good starting point.

Python

import csv, json

with open("data.csv", newline="", encoding="utf-8-sig") as f:
    rows = list(csv.DictReader(f))          # use delimiter=";" if needed

with open("data.json", "w", encoding="utf-8") as f:
    json.dump(rows, f, indent=2, ensure_ascii=False)

Node.js

// npm install csv-parse
import { readFileSync, writeFileSync } from "node:fs";
import { parse } from "csv-parse/sync";

const rows = parse(readFileSync("data.csv"), {
  columns: true, bom: true, skip_empty_lines: true,
});
writeFileSync("data.json", JSON.stringify(rows, null, 2));

Frequently asked questions

Is this CSV to JSON converter free?

Yes. There is no sign-up, no row limit imposed by a server and no watermark. The page is supported by ads.

Does it work with Excel files?

Yes — either save them as CSV, or use the dedicated Excel to JSON converter, which reads .xlsx files directly. Semicolon-separated files from European Excel are detected automatically.

How do I keep every value as a string?

Untick Detect numbers & booleans in Options. Every cell is then written as a JSON string exactly as it appears in the file.

What happens to empty cells?

By default they become empty strings (""). Tick Empty cells as null to get null instead. Short rows are padded so every object has the same keys.

Can I convert the JSON back to CSV?

Yes. Click the swap button between the format selectors and the current JSON output becomes the input of a JSON to CSV conversion.

Related converters