Free CSV to JSON Converter

Convert comma-separated values to JSON arrays or objects.

About CSV to JSON

CSV (Comma-Separated Values) is a simple tabular data format, while JSON (JavaScript Object Notation) is the standard format for APIs and web applications. This tool converts between them, handling quoted fields, escaped characters, and various delimiters. When "First row is header" is checked, column names become object keys in the JSON output.

How It Works

  1. Paste your CSV: Drop CSV text into the input box. Pick the delimiter that matches your data (comma, tab, semicolon, or pipe) from the dropdown.
  2. Configure options: Tick "First row is header" if the first line contains column names (they become JSON keys). Tick "Auto-detect types" to convert numbers and booleans automatically.
  3. Convert: Each CSV row becomes a JSON object with keys from the header row, or a plain array if there's no header.
  4. Copy or download: Copy the JSON array or download as a .json file for use in code or APIs.

Why Convert CSV to JSON?

CSV is the universal data export format for spreadsheets, databases, and analytics tools, but most modern APIs, JavaScript applications, and NoSQL databases work with JSON. Converting CSV exports from Google Sheets, Excel, Airtable, or database tools to JSON is a daily task in data engineering, web development, and API integration work. This converter handles common CSV edge cases: quoted fields containing commas, escaped quotes inside quoted fields, Windows-style line endings (CRLF), and mixed number/string columns with smart type detection.

Features

What is CSV to JSON conversion?

CSV to JSON conversion takes a flat tabular text file (rows of comma-separated values) and emits a JSON array where each row becomes an object keyed by the column headers. The same data ("name,age" newline "Alice,30" newline "Bob,25") goes from a two-row CSV to a JSON array of two objects, each with name and age fields. The conversion is reversible (json-to-csv covers the reverse direction).

CSV remains the universal export format for spreadsheets (Excel, Google Sheets, Numbers, LibreOffice Calc) and SQL databases (mysqldump, pg_dump). JSON is the dominant format for web APIs, NoSQL databases, and JavaScript applications. Converting between them is the most common interoperability task in data engineering, ETL pipelines, and front-end work.

This converter handles four delimiters (comma, semicolon, tab, pipe), optional header rows, and auto-detection of numeric and boolean types. It implements the RFC 4180 quoting rules so quoted fields with embedded commas, newlines, or doubled quotes parse correctly. Output is pretty-printed JSON with two-space indent ready for copy or download.

What is inside the converter

The top control bar exposes the three knobs that change the parsing behavior: a delimiter dropdown (comma, semicolon, tab, or pipe), a First row is header checkbox, and an Auto-detect types checkbox. Pick the delimiter that matches your source data first, then decide whether the header row should be promoted to object keys or kept as a data row.

The two textareas display the CSV input on the left and the JSON output on the right. The output is read-only and updates after you click Convert to JSON. A row counter under the buttons shows how many rows the parser recognized; if it differs from what you expected, double-check the delimiter or look for unbalanced quotes in your input.

Five action buttons sit under the panes: Convert to JSON runs the conversion, Copy writes the output to your clipboard, Sample loads a sample CSV so you can see the expected format, Clear empties both textareas, and Download saves the JSON as a .json file. There is also a hidden preview table that pops out when you click Sample, showing the parsed rows in a tabular layout.

History and background

Hollerith punch cards inaugurate tabular data (1890)

The 1890 US Census ran on Herman Hollerith's punched cards, each card holding fixed-position columns of data. The idea of rows-and-columns as a data format predates digital computers by 50 years. Every modern tabular format (CSV, TSV, Excel, Parquet) traces its rectangular shape to punch cards. The Computing-Tabulating-Recording Company that grew out of Hollerith's patents became IBM in 1924.

CSV emerges from FORTRAN list-directed I/O (1972)

IBM's FORTRAN compiler in 1972 introduced list-directed I/O where values separated by commas could be read into multiple variables in one call. The convention spread to BASIC, mainframe report formats, and early personal computing. By the 1980s most spreadsheet programs (VisiCalc, Lotus 1-2-3, Excel) could export comma-separated text. There was no single spec, so dialects proliferated.

RFC 4180 standardizes CSV (2005)

Yakov Shafranovich's RFC 4180, published in October 2005, gave CSV its first widely cited specification. It defined the use of CRLF line endings, double-quote escaping (a quote inside a quoted field is written as two quotes), and a single delimiter character. The RFC was Informational, not Proposed Standard, so many tools still deviate from it, but RFC 4180 remains the canonical reference for what well-formed CSV looks like.

JSON specified (2001) and standardized (2013)

Douglas Crockford documented JSON in April 2001. It was an obvious format for serializing JavaScript objects but quickly spread to every language. ECMA-404 standardized it in 2013, RFC 8259 superseded RFC 4627 in 2017. The format is intentionally minimal (no comments, no schema), which is exactly why it became the API lingua franca.

Locale-specific CSV variants emerge (1990s onward)

In countries where the comma is used as a decimal separator (France, Germany, most of continental Europe, Brazil), Excel exports CSV with a semicolon delimiter to avoid clashing with decimal commas. In Anglophone countries the comma stays. The same Excel installation produces different CSV depending on the operating system locale, which is why this converter exposes a delimiter dropdown rather than guessing.

PapaParse and the rise of in-browser CSV (2014)

Matt Holt's PapaParse (2014) became the de facto JavaScript CSV parser. Its design (auto-detect delimiter, handle large files with web workers, strict RFC 4180 compliance) became the template for every in-browser converter that followed. This tool implements a lighter-weight parser tuned for the four common delimiters and the most-cited RFC 4180 cases, without the workers (which are unnecessary for the kilobyte-to-megabyte inputs typical of this UI).

Practical workflows

Spreadsheet export to API request body

You exported a 200-row contact list from Google Sheets as CSV. Paste here, leave First row is header ticked, click Convert. The output JSON array is ready to POST to a CRM API endpoint that expects bulk-create.

Database seed file from CSV

You have a CSV of products from a legacy system. Convert to JSON, save as seed.json, and load it into MongoDB or DynamoDB with mongoimport or AWS CLI. The JSON array maps directly to a collection without an explicit schema.

Data for charting libraries (D3, Chart.js, Recharts)

D3.js accepts CSV directly via d3.csv, but Chart.js and Recharts want JSON. Convert your monthly sales CSV here, drop the resulting array into your React component, and pass it to a chart prop. The Auto-detect types option ensures numeric columns become actual numbers, not strings.

Mock data for a frontend

When building UI before the backend exists, mock data lives well in a JSON file imported with require or fetch. Sketch your records in a spreadsheet, export CSV, convert here, and paste into mockData.json. Iterate by editing the spreadsheet (which is easier than editing JSON by hand) and re-converting.

Log file analysis with jq

Some server logs are CSV-flavored. Convert to JSON, then pipe through jq to filter, sort, and aggregate. The conversion bridges the gap between flat-file logs and stream-processing tools that expect structured records.

CMS bulk import

Headless CMS platforms (Contentful, Sanity, Strapi, Directus) typically accept JSON imports. Editors write content in a familiar spreadsheet, you convert here and run a one-time import script. The header row becomes the field names that map to your CMS schema.

Common pitfalls

Quoted fields with internal commas

A row like 1,"Smith, John",30 has three logical fields, not four, because the comma inside the quoted field is data, not delimiter. This parser respects RFC 4180 double-quote escaping, but malformed CSV (missing closing quote, mismatched quotes) will produce nonsense JSON. Use a CSV linter or import the file into a spreadsheet first to surface structural errors.

Embedded newlines inside quoted fields

RFC 4180 allows literal newlines inside double-quoted fields, but many simple line-based parsers treat every newline as a record separator. If your CSV has multi-line comments or addresses inside quotes, the row count may not match the visual line count. This converter handles them correctly, but downstream tools may not.

Byte Order Mark (BOM) at file start

Windows tools (Excel especially) sometimes prefix UTF-8 CSV files with a three-byte BOM (EF BB BF). When you copy from a BOM-prefixed file, the first header gets an invisible prefix that mismatches "name" with "name" in your code. Open the file in a hex editor or strip BOMs with a one-liner (sed in unix, Get-Content in PowerShell) before pasting here.

Comma vs semicolon by locale

A French-locale Excel export uses semicolons because commas are decimal separators. Importing it with the default comma delimiter splits 1,234 into two fields. Always pick the delimiter that matches the source. If you are unsure, look at the first line in a plain text editor; the obvious separator is what you want.

Leading zeros lost on type coercion

Postal codes, phone numbers, and product SKUs often start with a zero (e.g., "01234"). Auto-detect types coerces these to integers, losing the leading zero (1234). For columns where leading zeros matter, uncheck Auto-detect types so the values stay strings. Or convert and then manually quote-wrap the affected fields.

Excel formula injection (CSV bomb)

If a CSV cell starts with =, +, -, or @, Excel may evaluate it as a formula when the file is opened. =cmd|'/c calc'!A1 launches the calculator on Windows machines. This is a known attack vector when web apps export user-controlled data to CSV. The conversion to JSON neutralizes the threat (JSON has no formula evaluation), but the original CSV remains dangerous.

Privacy and data handling

All parsing happens in your browser using a small JavaScript function. We do not send your CSV or JSON to a server, do not log inputs, and do not store outputs. The Copy and Download buttons interact with your operating system through standard user-gesture APIs and are invisible to third parties.

Once the page is loaded, the tool runs offline. You can disconnect from the network and convert customer lists, internal SKUs, or any data that must not leave your device. The tool is safe for HIPAA-adjacent workflows because the data path never crosses an external boundary.

When not to use this converter

Very large files (above 10 MB)

The converter keeps the entire input in memory and processes it synchronously, which freezes the browser tab on multi-million-row CSVs. For files above 10 megabytes, use a streaming parser (Python csv module, Node's csv-parse, Rust's csv crate) that reads one row at a time.

Nested object shape in cells

CSV is flat by design. If your data has nested objects or arrays inside cells (e.g., a tags column with comma-separated values), the conversion treats them as strings, not arrays. You will need a post-processing step in JavaScript or Python to split the string and rebuild the nested shape.

Binary or non-UTF-8 data

CSV files from older Windows systems may be encoded as Windows-1252 (CP-1252) instead of UTF-8. Special characters (é, ñ, ü) appear as mojibake when pasted into a UTF-8 textarea. Re-save the file as UTF-8 in your text editor (or run iconv from the command line) before pasting.

Real-time streaming data

If your CSV is being appended to continuously (a tail-style log feed), this batch tool cannot keep up. Use a streaming parser piped to a websocket or a database with a CSV ingest mode (Postgres COPY FROM, MySQL LOAD DATA INFILE).

More questions

Is the parser strictly RFC 4180 compliant?

Mostly. The parser handles double-quote escaping (two quotes inside a quoted field means a literal quote), quoted fields with embedded commas and newlines, and CRLF or LF line endings. It deviates from strict RFC 4180 by accepting unquoted fields with leading or trailing whitespace (which the spec disallows). This pragmatic tolerance matches what most real-world CSV exporters emit.

How does Excel quirky CSV affect the output?

Excel adds BOMs to UTF-8 files, sometimes uses Windows-1252 encoding, and prefers semicolons in non-English locales. Strip the BOM and re-save as UTF-8 before pasting. Pick the right delimiter from the dropdown. Watch out for leading zeros on number-like columns; Excel often dropping them on its own when you open the CSV.

What about UTF-8 with BOM versus pure UTF-8?

UTF-8 with BOM has a three-byte prefix (EF BB BF) that signals encoding. Most web tools (browsers, JSON parsers) prefer plain UTF-8 without BOM. If your CSV came from Excel's UTF-8 export, the BOM may be present, and the first header field will silently contain it. Strip the BOM (sed -i '1s/^\\xEF\\xBB\\xBF//' file.csv) before pasting.

Can I embed JSON inside a CSV cell?

You can, by enclosing the JSON in double quotes and escaping inner quotes. The converter treats the cell as a string, so the JSON inside stays as a string in the output. A post-processing step (JSON.parse on that field in your code) reconstructs the embedded object. This is a common pattern when shipping JSON inside spreadsheet exports.

Why is my output JSON missing some columns?

Most likely a row has fewer columns than the header (a trailing empty cell got dropped on export). The parser emits undefined for missing values, which JSON.stringify drops, so the resulting object has fewer keys than expected. Open the source file in a spreadsheet to see which rows are short, and either fix the data or post-process to fill defaults.

Does this support TSV (tab-separated values)?

Yes, pick Tab from the delimiter dropdown. TSV files are common when CSV files would have too many quoted cells (because tabs are rarely valid data in spreadsheet cells). The parser handles TSV identically except for the delimiter; quoting and escaping rules are the same.

Related Tools