Data & Format
Free CSV to JSON Converter Online
Convert CSV files to JSON arrays. Supports custom delimiters, header rows, type coercion, and one-click download.
What is CSV and when does it fall short?
CSV (Comma-Separated Values) is the oldest and most universal data interchange format in computing. Every spreadsheet application — Microsoft Excel, Google Sheets, LibreOffice Calc, Apple Numbers — can export to CSV with a single click. Database tools, payment processors, CRM systems, and analytics platforms all produce CSV reports. It is the lowest common denominator of structured data: plain text, human-readable, and trivially portable.
But CSV has hard limits that become painful the moment data leaves the spreadsheet world. It has no native type system — every value is a string. It cannot represent nested structures: a customer with multiple addresses, an order with multiple line items, a user with an array of tags. It has no standard for null vs empty string, no built-in schema, and no universally agreed encoding for special characters. Most importantly, the web ecosystem speaks JSON, not CSV.
REST APIs, NoSQL databases like MongoDB and Firestore, front-end frameworks, charting libraries, and configuration tools all expect JSON. The moment you need to import a CSV export from your accounting software into an API endpoint, or use a spreadsheet as seed data for a test suite, or load a dataset into a D3.js visualisation, you need to convert CSV to JSON. That is exactly what this tool does — instantly, in your browser, without sending your data anywhere.
What is JSON and why is it the standard?
JSON (JavaScript Object Notation) is a lightweight text format for structured data. It was formalised in RFC 8259 and is now the dominant serialisation format for web APIs, configuration files, and document-oriented databases. Unlike CSV, JSON has a rich type system: strings, numbers, booleans, null, arrays, and nested objects are all first-class citizens.
A CSV row like Alice,30,true has no inherent types — a CSV parser cannot know whether 30 is a string or an integer, or whether true is meant to be a boolean or the word "true". In JSON, the equivalent {"name":"Alice","age":30,"active":true} is unambiguous. This precision prevents downstream type coercion bugs that are notoriously hard to debug — especially when feeding data into a typed language like TypeScript, Go, or Rust, or when writing it to a relational database with strict column types.
Once your data is in JSON you can also validate it, format it with a dedicated tool like the JSON Formatter on this site, or minify it before sending over the network. JSON also compresses well with gzip, making it efficient for API responses.
How the CSV to JSON converter works
- 1Paste or type your CSV
Paste CSV text into the input area directly from the clipboard. You can copy rows from Excel, Google Sheets, or any CSV file opened in a text editor.
- 2Choose your delimiter
Select comma (the default for most English-locale exports), semicolon (common in European Excel exports where comma is the decimal separator), tab (used by Google Sheets "TSV" export and many database tools), or pipe.
- 3Toggle header row
When Headers is enabled, the first row is used as JSON object keys — giving you an array of named objects. When disabled, you get an array of arrays, which is useful for data without column names.
- 4Copy or download
Click Copy to write the JSON to your clipboard, or Download to save a .json file. The Pretty toggle controls indentation — useful for readability, or disable it to minimise payload size.
CSV syntax rules you need to know
CSV looks simple but has several edge cases that trip up naive parsers. This converter implements the full RFC 4180 specification so you don't have to worry about them, but understanding the rules helps you write valid CSV manually:
"New York, NY",35A field that contains the delimiter must be wrapped in double quotes. Without quoting, the parser would split "New York, NY" into two separate fields.
"He said ""hello""",28A literal double-quote inside a quoted field is represented as two consecutive double-quotes. This is the only escape sequence in RFC 4180 CSV.
"Line one
Line two",30A quoted field may span multiple lines. The embedded newline is part of the field value, not a row separator. This parser handles it correctly.
Alice,30
Bob,25
A trailing newline at the end of the file is optional and is silently discarded — it does not produce an empty last row.
name,age
Alice,30
BobRFC 4180 recommends consistent column counts per row. When a row is shorter than the header, missing fields are filled with empty string. Longer rows include extra fields under auto-generated keys.
CSV vs JSON: when to use each format
Both formats have their place. Knowing when to use each prevents unnecessary conversions and keeps your data pipeline simple.
| Criterion | CSV | JSON |
|---|---|---|
| Human readability | Easy for flat tables | Easy for nested structures |
| Type support | Strings only (by default) | String, number, boolean, null, array, object |
| Nested data | Not supported | First-class support |
| Spreadsheet import/export | Native in Excel, Sheets | Requires plugin or scripting |
| REST API payloads | Rarely used | Universal standard |
| Database imports | Widely supported (SQL tools) | Native in MongoDB, Firestore, DynamoDB |
| File size (uncompressed) | Smaller for wide tables | Larger due to key repetition |
| Schema enforcement | None | Via JSON Schema or TypeScript |
Common developer use cases
CSV-to-JSON conversion comes up in nearly every kind of software project. Here are the scenarios developers reach for this tool most often:
Automatic type coercion: numbers and booleans
One of the most valuable features of this converter is automatic type detection. In a raw CSV file everything is text, but JSON consumers expect proper types. When you convert 42 in a CSV column, the output JSON should contain the number 42, not the string "42" — otherwise TypeScript interfaces fail, database drivers insert wrong types, and arithmetic operations silently concatenate strings.
The coercion logic follows three simple rules, applied in order:
"true" or "false" (case-insensitive)→JSON boolean: true or falseCovers TRUE, False, FALSE — common in database exports.
Any string parseable as a finite number→JSON number: integer or float"42" → 42, "3.14" → 3.14, "-7" → -7. NaN and Infinity remain strings.
Anything else→JSON string (unchanged)Dates ("2024-01-15"), UUIDs, URLs, and free text stay as strings.
What to do with the JSON output
After converting your CSV, the JSON output is ready to use in several ways — and other free tools on this site can help with the next steps:
Paste the JSON into the JSON Formatter to check for syntax errors, prettify with consistent indentation, or minify it before committing to a repository or sending as an API payload.
If you need to pass the JSON as a URL query parameter or in an HTTP header, use the URL Encoder to percent-encode the special characters so it transmits correctly.
Before storing or distributing a JSON data file, you can generate a checksum with the Hash Generator (SHA-256 or SHA-512). This lets consumers verify the file hasn't been tampered with.
To embed small JSON datasets directly in HTML or as a data: URI in a script tag, encode the JSON output with the Base64 encoder.
Common pitfalls and how to avoid them
Watch out for these when working with CSV data
Some Windows tools add a UTF-8 BOM (\uFEFF) to the first field name. If your first key looks like "name" instead of "name", open the file in VS Code, change encoding from "UTF-8 with BOM" to "UTF-8", and save again.
Excel sometimes produces inconsistently quoted output — some cells quoted, others not. This converter tolerates mixed quoting, but deliberately malformed CSV (unmatched quotes) will produce a parse error.
Phone numbers, ZIP codes, and leading-zero identifiers like "007" or "01234" will be coerced to numbers (7, 1234), losing the leading zeros. Quote these fields in the CSV if preservation is required.
Dates like "2024-01-15" are left as strings (they're not valid numbers or booleans). This is correct — date parsing is locale-dependent and should be handled explicitly by the consuming application.
FAQ
Common questions
What is CSV and why would I convert it to JSON?
CSV (Comma-Separated Values) is a plain-text format for tabular data — rows of values separated by a delimiter (usually a comma). JSON (JavaScript Object Notation) is the standard data format for web APIs, NoSQL databases, and JavaScript applications. Converting CSV to JSON lets you import spreadsheet data directly into APIs, MongoDB, Firebase, or any JavaScript-based pipeline without writing a custom parser.
Does the first row have to be a header row?
No, but using header rows produces much more useful output. When "Use first row as headers" is enabled, each JSON object's keys are taken from that header row — giving you {"name":"Alice","age":30} instead of ["Alice","30"]. If your CSV has no headers, disable the option and you'll get an array of arrays instead.
What delimiters are supported?
This converter supports comma (,), semicolon (;), tab (\t), and pipe (|) delimiters. Semicolon-delimited files are common exports from European Excel installations where comma is the decimal separator. Tab-separated values (TSV) are often exported by Google Sheets and database tools.
How are quoted fields handled?
The parser correctly handles RFC 4180 quoting rules. A field wrapped in double quotes can contain commas, newlines, and other special characters without breaking the structure. A literal double-quote inside a quoted field must be escaped as two consecutive double-quotes ("").
What happens to empty fields?
Empty fields between delimiters — such as "Alice,,30" — are preserved as empty strings ("") in the JSON output. This is intentional: silently dropping empty fields would misalign column indexes. If you need null instead of empty string, a small post-processing step in your code can handle that: obj[key] = val === "" ? null : val.
Are numbers and booleans auto-detected?
Yes. The converter attempts to coerce values: numeric strings like "42" and "3.14" become JSON numbers, and "true"/"false" (case-insensitive) become JSON booleans. Everything else stays a string. This matches the behavior of most CSV-to-JSON libraries and prevents downstream type errors when feeding data into APIs or databases.
What is the maximum file size this tool supports?
Because all processing runs locally in your browser, practical limits depend on your device's memory. In testing, files up to several megabytes parse in under a second on modern hardware. For very large datasets (tens of MB), consider a server-side tool or a streaming parser like Papa Parse in Node.js.
Is my CSV data sent to any server?
No. The entire conversion runs in JavaScript inside your browser tab. Your CSV content never leaves your device. This makes the tool safe for confidential data — internal reports, user exports, financial spreadsheets — without any privacy risk.
How do I handle CSV files with special characters or non-ASCII text?
Modern browsers handle UTF-8 text natively, so accented characters, CJK characters, and emoji paste correctly from the clipboard. If you're reading a file saved in a legacy encoding (Windows-1252, Latin-1), re-open it in your text editor, save it as UTF-8, then paste the content here.
What should I do with the JSON output after converting?
Common next steps: paste it into the JSON Formatter on this site to validate and prettify it before committing to a codebase; use it as a fixture file for unit tests; POST it to an API endpoint; or import it directly into MongoDB with mongoimport --jsonArray. The downloaded .json file can also be used as a data source in tools like D3.js, Vega, or any charting library.
More in Data & Format