CSV to JSON Converter
Convert CSV to a JSON array of objects or arrays — quoted fields, custom delimiters, all in your browser.
About the CSV to JSON Converter
The CSV to JSON Converter takes comma-separated data — the kind you export from a spreadsheet, a database dump, or an analytics report — and turns it into clean, structured JSON you can paste straight into code, an API request, or a config file. You choose whether the first row holds column names (producing a JSON array of objects) or whether every row is just data (producing an array of arrays). It understands real-world CSV, not just the tidy examples: fields wrapped in double quotes, commas inside those quoted fields, line breaks inside a cell, and the doubled-up "" that CSV uses to escape a literal quote. Everything runs in your browser, so nothing you paste is uploaded, stored, or logged.
CSV is everywhere because it's simple, but that simplicity hides sharp edges. A single value like "Smith, John" contains a comma that must not split the row, and a naive "split on commas" approach mangles it instantly. This converter parses character by character, tracking whether it's inside a quoted field, so those values survive intact. The result is JSON that mirrors your data exactly — ready for JavaScript, Python, testing fixtures, or seeding a database.
How to use
- Paste your CSV into the Input box. It can come straight from Excel, Google Sheets, a database export, or a
.csvfile opened in any text editor. - Pick a delimiter. Leave it on Auto-detect to let the tool guess from your first line, or force Comma, Semicolon, or Tab — semicolons are common in European locales, tabs in TSV exports.
- Set "First row is header." When on (the default), the first row becomes the keys of each JSON object. Turn it off to keep every row as a plain array of values instead.
- Choose Pretty or Minified output. Pretty adds indentation for readability; Minified collapses everything to one compact line for pasting into a request body.
- Click Convert to JSON. The result appears in the read-only Output box, with a small confirmation showing how many rows were converted.
- Copy the output with the Copy button, or hit Clear to empty both boxes and start fresh.
If the CSV is malformed — most often an opening quote with no matching closing quote — the Output stays empty and a friendly red message explains what to fix. Correct that spot in the input and convert again.
Frequently asked questions
Is my data uploaded or stored anywhere?
No. All parsing and conversion happen locally in your browser using JavaScript. Your CSV is never sent to a server, saved, or logged, so the tool is safe for confidential exports, customer lists, or internal reports. Close the tab and the data is gone.
How are quoted fields and commas inside cells handled?
The parser reads your text one character at a time and tracks whether it's inside a double-quoted field. A comma (or your chosen delimiter) inside quotes is treated as part of the value, not a column break. Line breaks inside quotes are preserved too. To include a literal double quote in a value, double it — "She said ""hi""" becomes the value She said "hi", exactly as the CSV standard specifies.
What's the difference between the two output shapes?
With "First row is header" on, you get an array of objects, where each object's keys come from the header row — ideal for most APIs and code. With it off, you get an array of arrays, preserving raw row-and-column positions with no key names. Choose objects when your columns have meaningful names, arrays when position matters more than labels.
What happens with blank or duplicate header names?
An empty header cell is given a placeholder name like column1, column2, and so on, based on its position, so no key is ever missing. If two headers share the same name, standard JSON object behavior applies and the later column overwrites the earlier one for that key — rename the columns in your source if you need both.
Which delimiter should I choose?
If you're unsure, keep Auto-detect: it inspects the first line (ignoring anything inside quotes) and picks the most frequent separator among comma, semicolon, and tab. Force a specific delimiter when your data is unusual — for instance a comma-heavy dataset that's actually semicolon-separated, where auto-detection could otherwise guess wrong.
Why did I get an error, and what does it mean?
The usual cause is an unbalanced quote: a field opens with " but never closes, so the parser can't tell where the value ends. The error names the problem so you can find the stray quote. Ragged rows don't error — extra cells are ignored and missing cells become empty strings.