CSV to JSON Converter
A CSV to JSON converter reads a Comma-Separated Values file — where the first row contains column headers and each subsequent row is a data record — and outputs a JSON array of objects where each object's keys are the header names and values are the corresponding cell values. The reverse direction (JSON to CSV) flattens an array of objects back to tabular form.
How it works
CSV (Comma-Separated Values) is a plain-text format where each line is a record and fields are separated by a delimiter — usually a comma. It is one of the most common formats for exchanging tabular data between spreadsheets, databases, and APIs.
This tool parses your CSV using a compliant RFC 4180 parser — handling quoted fields, embedded commas, escaped double quotes, and multi-line cell values — then serialises the result to a JSON array. Each data row becomes a JSON object whose keys are the header names from the first row.
Switch to JSON → CSV mode to go the other way: paste a JSON array of objects and the tool generates a properly quoted CSV file.
Last updated: November 2026
CSV Format Quick Reference
| Rule | Example CSV | Parsed Value |
|---|---|---|
| Plain field | Alice | "Alice" |
| Field with comma — wrap in quotes | "Engineer, Berlin" | "Engineer, Berlin" |
| Embedded double quote — escape as "" | "say ""hello""" | 'say "hello"' |
| Multi-line field | "Line 1 Line 2" | "Line 1\nLine 2" |
| Empty field | Alice,,30 | "" (empty string) |
Tips & Tricks
All values are strings
CSV has no type system. The number 42 and the string "42" are identical in CSV. After converting, use JSON.parse or a Zod schema to coerce types if you need numbers or booleans.
Paste directly from Excel or Sheets
Copying cells from Excel or Google Sheets puts tab-separated data on your clipboard. Set the delimiter to Tab (or use Auto-detect) before pasting.
JSON → CSV flattens only one level
Nested JSON objects ({"address": {"city": "Berlin"}}) are stringified as "[object Object]" in CSV. Flatten your JSON first, or use jq: jq -r '.[] | [.name, .address.city] | @csv'.
Missing keys become empty cells
When converting JSON → CSV, if one object has a key that others do not, the missing cells are left empty. The header row always includes every key found across all objects.
Auto-detect reads only the first line
The delimiter auto-detector counts occurrences of , ; | and \t in the first row and picks the highest count. If the first row is atypical, switch to manual.
Large files convert in milliseconds
The parser runs synchronously in your browser thread. Files up to ~10 MB convert instantly. For 100 MB+ files, consider a streaming CLI tool like csvkit or Miller (mlr).
Code Examples
Node.js — csv-parse
const { parse } = require('csv-parse/sync');
const fs = require('fs');
const csv = fs.readFileSync('data.csv', 'utf8');
const records = parse(csv, {
columns: true, // use first row as keys
skip_empty_lines: true,
trim: true,
});
console.log(JSON.stringify(records, null, 2)); Node.js — JSON to CSV (csv-stringify)
const { stringify } = require('csv-stringify/sync');
const data = [
{ name: 'Alice', role: 'Engineer' },
{ name: 'Bob', role: 'Designer' },
];
const csv = stringify(data, { header: true });
console.log(csv); Python — csv.DictReader
import csv
import json
with open('data.csv', newline='', encoding='utf-8') as f:
reader = csv.DictReader(f)
records = list(reader)
print(json.dumps(records, indent=2)) CLI — csvkit
# Install csvkit (Python)
pip install csvkit
# Convert CSV to JSON
csvjson data.csv > data.json
# Using jq to reshape after conversion
csvjson data.csv | jq '[.[] | {name, role}]' Frequently Asked Questions
How does CSV to JSON conversion work?
The first row is read as column headers. Each subsequent row is converted to a JSON object where each key is a header name and each value is the corresponding cell. A CSV with headers "name,age" and row "Alice,30" becomes {"name":"Alice","age":"30"}. The full output is a JSON array containing one object per data row. This array-of-objects structure is the most common JSON representation for tabular data because it makes each record self-describing — you can pass any single object to a function without needing to know its column index. The process respects RFC 4180 quoting rules, so cells containing commas, newlines, or double-quotes are handled correctly. Missing cells produce an empty string value, and extra cells beyond the header count are silently discarded. Tools like jq, Python's json module, and MongoDB's mongoimport all accept this format natively.
What CSV delimiters are supported?
Comma (,), tab (\t), semicolon (;), and pipe (|). The Auto-detect option reads the first line and picks the delimiter that appears most frequently. Tab-separated files (TSV) from Excel or Google Sheets are detected automatically. Comma is the most common delimiter in English-speaking countries; semicolon is frequently used in European locales where the comma serves as the decimal separator (e.g. 1.234,56 in German formatting). Pipe-delimited files are common in legacy financial and mainframe data exports where field values may contain both commas and semicolons. Auto-detection works well for clean data, but if your first row is atypical — for example a row containing many commas inside quoted fields — switching to manual delimiter selection is safer to avoid misdetection.
What happens to quoted fields in CSV?
Quoted fields follow RFC 4180. A field wrapped in double quotes may contain the delimiter, newlines, and double quotes. A literal double quote inside a quoted field is escaped by doubling it: ""hello"" becomes "hello" in the output. This parser handles all standard RFC 4180 quoted fields correctly. A common real-world example is an address field that contains a comma: "123 Main St, Suite 400" must be quoted to prevent the comma from being interpreted as a column boundary. Multi-line cell values (such as a notes field containing a paragraph break) are also valid under RFC 4180 as long as the entire field is wrapped in double quotes. Fields that do not contain special characters do not need to be quoted, though quoting them anyway is valid. Excel and Google Sheets both produce RFC 4180-compliant CSV when you use File > Download > CSV.
Can I convert JSON back to CSV?
Yes — switch to the JSON → CSV tab. Paste a JSON array of objects, and the tool generates a CSV with the object keys as the header row. Missing values produce empty cells. Fields containing commas, quotes, or newlines are automatically wrapped in double quotes. The header row is built from the union of all keys across all objects in the array, so if some records have extra fields not present in others, those columns still appear in the CSV with empty cells for the rows that lack them. One important limitation: JSON → CSV flattens only one level. Nested objects like {"address": {"city": "Berlin"}} are serialised as the string "[object Object]" in the cell. If your JSON is nested, flatten it first using jq (e.g. jq '.[] | {name, city: .address.city}') before converting to CSV.
Are all JSON values treated as strings in the output?
Yes. CSV has no type information, so all cell values become strings in the JSON output. If you need typed values (numbers, booleans), post-process with JSON.parse on individual fields, or use a schema validation library like Zod to coerce types after conversion. For example, after converting you might run: data.map(row => ({ ...row, age: Number(row.age), active: row.active === "true" })). In Python, csv.DictReader also returns all values as strings — use int(), float(), or json.loads() to cast individual fields. Zod is particularly useful because it validates and coerces simultaneously: z.array(z.object({ name: z.string(), age: z.coerce.number() })).parse(data) will raise a typed error if any age field cannot be parsed as a number, making type conversion failures explicit rather than silent.
How do I handle a CSV without a header row?
Toggle off "First row is header". Without headers, the JSON output is an array of arrays — each row becomes an array of string values rather than an object. This is useful for CSVs produced by some database exports or scientific tools that do not include a header row, treating column position as the implicit field identifier. When no header row is present, the first data row is treated as a data record, not column names — so if you accidentally leave the toggle on, the first data row will become your key names, which is usually wrong. For downstream processing of headerless CSVs, consider adding synthetic column names using Python's csv.DictReader with a fieldnames argument, or using the csv-parse npm package with the columns option set to a custom array of names.
What is RFC 4180?
RFC 4180 (published 2005) is the de-facto standard for CSV files. It defines that fields may be enclosed in double quotes, embedded double quotes are escaped as "", records are separated by CRLF, and the first record may be a header row. Excel, Google Sheets, and LibreOffice all export RFC 4180-compliant CSV. Despite being a de-facto standard, RFC 4180 is informational rather than a formal Internet Standard — meaning real-world CSV files regularly deviate from it. Common non-conformances include using LF instead of CRLF as the line terminator, using backslash to escape double quotes instead of doubling them, and mixing quoted and unquoted fields within the same file. A robust CSV parser should handle all these variants gracefully. The csv-parse npm package and Python's csv module both offer options to control quoting rules, escape characters, and line terminators for dealing with non-standard CSVs.
What is the difference between CSV and TSV?
CSV uses commas as the delimiter; TSV (Tab-Separated Values) uses tab characters (\t). TSV is preferred when field values may contain commas. When you copy cells from Excel or Google Sheets, the clipboard content is tab-separated — set the delimiter to Tab or use Auto-detect. TSV is also common in bioinformatics (FASTQ quality scores, BED format, VCF variant call files) where data fields often contain commas but rarely contain tab characters. One practical difference: TSV files generally require less quoting overhead because tab characters are uncommon in natural-language text, whereas CSV files must quote any field containing a comma. The file extensions .csv and .tsv both describe plain text; the MIME types are text/csv and text/tab-separated-values respectively. Both formats are natively importable into Excel, Google Sheets, and LibreOffice Calc without any special import wizard.
Is my data sent to a server?
No. All parsing and conversion runs in your browser using JavaScript. No data is uploaded, stored, or logged. You can safely convert private or sensitive CSV data. The CSV parser and JSON serialiser are implemented as pure TypeScript functions with no external network calls — processing happens entirely within your browser's JavaScript engine. This means you can use this tool safely with salary spreadsheets, customer PII exports, medical records, or any other confidential tabular data. You can verify this by opening your browser's DevTools Network tab while pasting a CSV — you will observe zero outbound requests triggered by the conversion. The tool also works fully offline once the page has loaded.
How do I convert CSV to JSON in Python?
Use the built-in csv and json modules: import csv, json; with open("data.csv") as f: reader = csv.DictReader(f); data = list(reader); print(json.dumps(data, indent=2)). csv.DictReader uses the first row as keys, producing the same array-of-objects structure this tool generates. Always open the file with newline="" as the second argument — csv.DictReader("data.csv", newline="") — to prevent the universal newlines mode from corrupting multi-line field values. For UTF-8 encoded CSV files with a BOM (produced by Excel), pass encoding="utf-8-sig" to strip the BOM automatically. If your CSV uses a non-comma delimiter, pass the delimiter argument: csv.DictReader(f, delimiter=";"). All values are strings; cast types afterwards as needed. For very large files, avoid list(reader) and iterate lazily: for row in reader: process(row).
How do I convert CSV to JSON in JavaScript / Node.js?
Use the csv-parse npm package: const { parse } = require("csv-parse/sync"); const records = parse(csvString, { columns: true, trim: true }). For the browser, use papaparse: Papa.parse(csvString, { header: true }) returns { data: [...] } matching this tool's output. Install csv-parse with npm install csv-parse — it is part of the csv project (npm: csv) which also provides csv-stringify for the reverse direction. PapaParse is the most popular browser-side CSV library (over 12 million weekly npm downloads) and supports streaming large files via its worker mode: Papa.parse(file, { header: true, worker: true, step: row => process(row) }). For Node.js streams with large files, use the async csv-parse API with pipeline: const { pipeline } = require("stream"); pipeline(fs.createReadStream("data.csv"), parse({ columns: true }), transform, done).
Can I download the converted JSON?
Yes — click Download after converting to save the output as a .json or .csv file. The download is generated in your browser with no server involved. The file is created using the Blob API: new Blob([content], { type: "application/json" }) for JSON or type: "text/csv" for CSV, then a temporary object URL is created and clicked programmatically. The resulting file is named "converted.json" or "converted.csv". This technique works in all modern browsers including Chrome, Firefox, Safari, and Edge. Downloaded JSON files can be directly imported into MongoDB (mongoimport --file data.json --jsonArray), PostgreSQL (via COPY with jsonb columns), or any REST API that accepts an application/json request body. The CSV download is immediately openable in Excel, Google Sheets, and LibreOffice Calc.
Related Tools
Format, validate, and minify JSON. Sort keys, find duplicates, tree view.
Convert YAML to formatted JSON instantly. Anchors expanded, no server.
Convert JSON to clean, readable block-style YAML instantly.
Convert XML to structured JSON. Attributes preserved as @_ keys.
Compare two JSON objects and see added, removed, and changed keys with paths.
Run jq queries against JSON data instantly in your browser.