How to convert CSV to JSON — step by step
- Paste or type your CSV into the input box. You can paste directly from Excel (Ctrl+C on a selection copies tab-separated values), from Google Sheets, or from any text editor.
- Choose your delimiter. The default is comma. If your data is tab-separated (TSV), select Tab. European Excel exports often use semicolon as the delimiter because the comma is reserved as a decimal separator in some locales. Pipe (
|) is common in database exports where fields may contain commas. - Toggle "First row is header". When checked, the first row becomes the property names and each subsequent row becomes a JSON object. When unchecked, all rows (including the first) become arrays of values — useful when there is no header row or when you want to process headers programmatically.
- Toggle "Auto-type". With auto-typing on, numeric strings like
42and3.14become JSON numbers,trueandfalsebecome booleans, and empty cells becomenull. With it off, every value stays a string. - Choose indent. 2-space indent produces readable JSON; minified produces the most compact output for embedding in other formats.
- Copy the output. The Copy button puts the JSON on your clipboard, ready to paste into a code file, API client, or another tool.
Why CSV parsing is harder than it looks
CSV looks trivial — comma-separated lines, right? A correct RFC 4180 parser has to handle a surprising number of edge cases that a naive split-on-comma approach gets wrong every time:
- Quoted fields containing the delimiter.
"Smith, John"is one field, not two. The comma inside the quotes must not be treated as a separator. - Escaped quotes inside quoted fields. RFC 4180 uses doubled quotes:
"say ""hello"""decodes tosay "hello". Backslash escaping is not part of the standard. - Embedded newlines inside quoted fields. A field value that contains a literal newline must be quoted — and the parser must recognize that the newline ends the field, not the record.
- Mixed line endings. A CSV created on Windows uses CRLF (
\r\n). Opened on macOS or Linux and re-saved, it may have LF only. Opened on old macOS, it may have bare CR. A robust parser normalizes all three. - Trailing newline. Many CSV exporters append a newline after the last record. A naive parser that splits on newlines produces a spurious empty final row. RFC 4180 explicitly allows but does not require the trailing newline.
- Byte Order Mark (BOM). Excel-generated CSV files often begin with a UTF-8 BOM (
). This must be stripped before parsing or the first header field will have an invisible prefix character.
This tool uses a proper state-machine parser that handles all of these cases correctly, matching RFC 4180 behavior.
Output formats explained
The tool produces one of two output shapes depending on the header toggle:
- Array of objects (header on). The most common format for API consumption. Each row becomes a JSON object with the column names as keys. This is directly usable with
Array.prototype.map(),filter(), and most data libraries. - Array of arrays (header off). Each row (including the first) becomes an array of values. Use this when you want to process the header row programmatically, or when the CSV has no header row at all.
Example: a 3-row CSV with headers converts as follows. Input:
id,name,salary,active
1,Alice,95000,true
2,Bob,87500,true
3,Carol,,false Output with header on and auto-type on:
[
{ "id": 1, "name": "Alice", "salary": 95000, "active": true },
{ "id": 2, "name": "Bob", "salary": 87500, "active": true },
{ "id": 3, "name": "Carol", "salary": null, "active": false }
] Notice that id and salary become numbers, booleans become JSON booleans, and the empty salary cell for Carol becomes null.
Auto-typing: what gets converted and when
With auto-type enabled, the converter applies these rules to every field value after stripping surrounding whitespace:
- Empty string →
null. An empty cell (two adjacent delimiters or a field with no content) becomes JSONnull. - Integer pattern → number. A string that matches a plain integer with no leading zeros (e.g.,
42,-7) becomes a JSON number. - Float pattern → number. Strings matching decimal numbers (e.g.,
3.14,-0.5,1e6) become JSON numbers. true/false(case-insensitive) → boolean. The stringsTRUE,True,trueall become JSONtrue.- Everything else → string. Dates, phone numbers, postal codes, and anything else stay as strings.
Turn auto-type off when you need all values as strings — for example, when preserving leading zeros in zip codes (07030) or product codes that look like numbers.
Supported delimiters
- Comma (,) — the RFC 4180 default. Used by most CSV exporters.
- Tab (\t) — TSV format. Excel copies tab-separated values to the clipboard. Many log analysis tools produce TSV.
- Semicolon (;) — the European Excel default. In locales that use comma as the decimal separator, Excel uses semicolons to avoid ambiguity.
- Pipe (|) — common in database exports and legacy ETL pipelines where commas appear frequently in text fields.
CSV to JSON vs JSON to CSV — when to go which direction
CSV → JSON is the right move when you are loading tabular data into a JavaScript application, a REST API, a document database, or a data visualization library. JSON is natively understood by every modern programming environment.
JSON → CSV is useful when you need to open data in a spreadsheet, import it into a relational database via COPY or LOAD DATA, or hand it to a business analyst. Flat JSON arrays of objects map cleanly to CSV rows; nested structures require flattening first.
Common data sources for this tool
- Excel / Google Sheets exports — File → Download → CSV. Headers in row 1, comma delimiter.
- PostgreSQL —
COPY table TO STDOUT WITH CSV HEADERproduces RFC 4180 output. - MySQL —
SELECT ... INTO OUTFILE 'file.csv' FIELDS TERMINATED BY ','. - GitHub API / REST APIs — some endpoints support
Accept: text/csvfor bulk exports. - Salesforce reports — exported as CSV with UTF-8 BOM. The parser handles the BOM automatically.
- Log aggregators — Splunk and Datadog can export search results as CSV or TSV.
Performance notes
The parser runs entirely in the browser's main thread. Files up to approximately 50 MB parse without noticeable lag on a modern machine. Above that threshold, the UI may become sluggish as the parser builds and serializes a large JSON tree.
For large files, the right tool is a streaming parser. In Python, the built-in csv
module reads row-by-row and never loads the entire file into memory. In Node.js,
the csv-parse package supports a streaming interface via Transform streams. Both handle
files of arbitrary size in constant memory.
FAQ
Does it handle Excel CSV files correctly?
Yes. Excel exports are RFC 4180 compliant: fields containing commas or quotes are quoted, line endings are CRLF, and the file is UTF-8 with an optional BOM. The parser handles all of these automatically. If your Excel file uses a semicolon delimiter (European locale), switch the delimiter selector to semicolon before converting.
Can I convert JSON back to CSV with this tool?
Not currently — this tool is CSV → JSON only. To go the other direction, you can use a spreadsheet: paste your JSON array of objects into a JS console, call Object.keys(arr[0]) for headers, then map values row-by-row. A dedicated JSON → CSV tool is on the roadmap for this site.
What is the maximum file size?
The browser-based parser handles up to approximately 50 MB smoothly. For larger files — database dumps, full analytics exports — use Python's csv module or Node's csv-parse with streaming to avoid loading the entire file into memory. Both support arbitrarily large files and produce identical RFC 4180-compliant output.
Related tools
- JSON Formatter — Format, validate, and beautify JSON online. 100% client-side — your data never leaves your browser.
- XML Formatter — Format, validate, and beautify XML documents.
- YAML ↔ JSON Converter — Convert between YAML and JSON formats with full fidelity.
- JSON Diff — Compare two JSON objects structurally with field-by-field diff.
Related articles
- 5 min readCSV Data Validation — Schema Validation, Type Checking, and Error ReportingValidate CSV files before importing them into a database or processing pipeline. Learn how to check required columns, validate data types, enforce email/date/numeric formats,...
- 5 min readImport CSV to Database — PostgreSQL, MySQL, SQLite, and Node.jsImport CSV files into PostgreSQL, MySQL, and SQLite using COPY commands, LOAD DATA INFILE, and Node.js streaming inserts. Covers bulk import performance, handling encoding...
- 5 min readCSV with Python pandas — read_csv, to_json, Data Cleaning, and ExportRead, clean, and convert CSV files with Python pandas. Covers pd.read_csv() options, handling missing values, type conversion, filtering, groupby aggregations, and exporting to...
- 5 min readParse CSV in JavaScript — PapaParse, csv-parse, and Manual ParsingParse CSV files in JavaScript with PapaParse (browser), csv-parse (Node.js), or the native streaming API. Covers headers, quoted fields, custom delimiters, and async streaming...
- 4 min readTSV Format Guide — Tab-Separated Values vs CSVTSV (Tab-Separated Values) avoids the quoting complexity of CSV because tab characters rarely appear in data. Learn the TSV format, when to prefer TSV over CSV, and how to...
- 5 min readCSV Format Guide — Structure, Delimiters, and Common Parsing IssuesCSV (Comma-Separated Values) is a simple tabular text format. Here's the RFC 4180 standard, delimiter variations, quoting rules, and how to parse CSV correctly in code.
Pillar
Part of Data & Format — JSON, YAML, XML, CSV, SQL, Markdown.
Written by Mian Ali Khalid. Last updated 2026-05-13.