CSV to JSON Converter
DataConvert CSV data to formatted JSON instantly. Handles quoted fields, custom delimiters, and header rows. Runs entirely in your browser — nothing is uploaded.
What is a CSV→JSON?
The CSV to JSON Formatter converts comma-separated values (or any delimiter-separated tabular data) into a formatted JSON array of objects, making the data immediately usable in JavaScript applications, REST APIs, MongoDB imports, and any other tool that works with JSON rather than flat text files.
CSV is the most common format for tabular data exports — from Excel spreadsheets, Google Sheets, database exports, CRM downloads, and report generators. But CSV has significant limitations for modern development: it has no type information, no nested structure, and no standard way to represent null values. When you need to process the data in JavaScript, load it into a document database, or pass it to an API, you need JSON.
The conversion is straightforward conceptually — each row becomes an object, each header becomes a key — but the implementation requires a proper CSV parser. A naive split(',') breaks immediately on any value that contains a comma inside quotation marks, such as "Mumbai, Maharashtra". The CSV to JSON Formatter uses an RFC 4180-compliant parser that handles all standard CSV edge cases:
- Quoted fields containing the delimiter character:
"value,with,commas" - Escaped quotes inside quoted fields:
"He said ""hello""" - Values containing newlines inside quotes
All conversion runs entirely in your browser — no CSV data is uploaded to any server. This is particularly important for CSV files that contain personal information, financial data, or internal business records. Use the JSON Formatter to inspect and pretty-print the JSON output, or the XML Formatter if your target format is XML rather than JSON.
How to use this CSV→JSON calculator
- Paste your CSV data into the CSV Data input box — include the header row if your data has one.
- Select the Delimiter from the dropdown that matches your data: Comma, Semicolon, Tab, or Pipe.
- Toggle First row is a header on (for labelled output as an array of objects) or off (for a raw array of arrays).
- Choose a JSON Indent style: 2 spaces, 4 spaces, or Minified.
- The JSON Output updates instantly as you change any option.
- Click Copy to copy the JSON to your clipboard.
Formula & Methodology
CSV parsing (RFC 4180-compliant): Each row is parsed character by character. When a field starts with", the parser reads until a closing"that is not followed by another"(double-quote escape). Everything inside the quotes — including delimiter characters and newlines — is treated as part of the field value. Unquoted fields are read until the next delimiter or end of line. Object construction: When header mode is enabled, the first row's fields are used as keys. For each subsequent row, the parser creates an object by zipping the keys array with the row's values array. Rows shorter than the header produce objects with""for missing values; extra columns are dropped. When header mode is disabled, each row is returned as a plain string array. JSON serialisation: The resulting array is serialised withJSON.stringify(rows, null, indentSize), whereindentSizeis 2, 4, orundefined(minified). Before (CSV):name,age,city Alice,30,"Mumbai, Maharashtra" Bob,25,DelhiAfter (JSON, 2-space indent):json [ { "name": "Alice", "age": "30", "city": "Mumbai, Maharashtra" }, { "name": "Bob", "age": "25", "city": "Delhi" } ]