CSV to JSON Converter

Paste CSV and get JSON back — the first row becomes the field names, every following row becomes an object. Quoted fields containing commas are handled properly, and a malformed row gets an honest error naming the row.

Runs in your browser — your code and data never leave this device

How do I convert CSV to JSON for free?

Paste your CSV here: this free online CSV to JSON converter turns each row into a JSON object, using the first row as the field names. Quoted fields — commas, quotes and line breaks inside a field — are handled correctly, and a bad row is reported with its row number. Nothing is uploaded.

Size: 0 B → 0 B
Input characters: 0

Related tools

How to use the CSV to JSON Converter

  1. Paste your CSV into the Input box on the left, or click Sample to load an example. The first row must be the header row.
  2. Click Convert to JSON. Each following row becomes one object, with the header names as its keys.
  3. If a row has the wrong number of fields, the error names the row — fix it in the input and convert again.
  4. Click Copy output or Download to save the JSON, then use it in your app, API test or config file.

For the full picture — the quoting quirks that break naive converters — read our guide: How to Convert CSV to JSON.

How the conversion works

A CSV file is a table, and a JSON array of objects is the same table in a different shape. This tool reads the first row as the field names, then turns every following row into one object whose keys are those names. Three data rows become three objects, each with the same keys — the shape APIs and JavaScript code expect.

All values come out as strings, because CSV carries no type information: a price of 899 becomes the string "899", not the number 899. That is deliberate — guessing types would silently change your data. If you need numbers, convert them in code after importing, where the conversion is visible and under your control.

The output shape — an array of objects with identical keys — is the shape most code expects. You can paste it into a JavaScript file, send it to an API that accepts JSON, load it into a database that imports JSON documents, or use it as test data. It is also easy to reshape from here: filter the array, pick out one field, or nest it under another object, all with a few lines of code.

The CSV quirks it handles

Real-world CSV is messier than the textbook version. Fields that contain commas are wrapped in quotes, and this parser honours those quotes: "Laptop, 15 inch" stays one field. A quote inside a quoted field is written doubled (""), and the parser turns it back into a single quote. Line breaks inside quoted fields are kept as part of the field, not treated as row breaks.

Files saved on Windows end their lines with a carriage return plus a newline, and files from other systems use a newline alone — both are accepted. Trailing blank lines at the end of the file are ignored, and empty fields become empty strings rather than errors.

When a row fails

The most common failure is a row with the wrong number of fields: a missing comma, or a quote that was opened and never closed, so the rest of the row collapses into one field. The error message names the row number and tells you how many fields it found versus how many the header has, so you can jump straight to the problem instead of counting commas by eye.

If the whole file fails with an unclosed-quote error, the culprit is usually a single stray quote mark somewhere in the middle — often in a product name or a note written by hand. Find it, remove it or quote the field properly, and the file will convert.

Headers become field names: how the conversion works

CSV to JSON with headers works on one simple rule: the first row is the header, and every row after it becomes an object with those field names. A spreadsheet exported as CSV converts cleanly this way — export the sheet, paste the CSV here, and the JSON is ready to copy or download. Fields that contain commas, quotes or line breaks are handled as long as they are quoted, the way spreadsheets quote them on export.

Two honest limits belong here. Every value becomes a string in the JSON, because a CSV file carries no type information — a column of numbers comes out as strings, and converting them back to numbers is a step for your code. And the header row is required: a CSV without one cannot convert, because there would be no field names for the objects. If a row is malformed, the error names the row number, so you can find and fix it.

Frequently asked questions

What if a row has fewer fields than the header?

The conversion stops with an honest error naming the row and the field counts. Fix the row in the input — usually a missing comma or an unclosed quote — and convert again.

Are numbers kept as numbers?

No. CSV has no type information, so every value becomes a string in the JSON. Convert values to numbers in your own code after importing, where the conversion is visible.

What about commas inside a field?

They are handled when the field is quoted. A quoted field may contain commas, quotes and line breaks. An unquoted comma always splits fields, which is how CSV works.

Can I convert a CSV without a header row?

No. The first row is always treated as the field names. If your file has no headers, add a header row first, or the first data row will be used as the names.

Is my data uploaded anywhere?

No. This tool runs entirely in your browser using JavaScript. Your data is never uploaded, stored or sent anywhere — everything stays on this device.

Can I convert a spreadsheet to JSON with this tool?

Yes — export the spreadsheet as a CSV file, open it in a text editor, and paste the contents here. The first row becomes the field names, each row after it becomes a JSON object, and you can copy or download the result.

How do I copy or download the JSON?

The converted JSON appears below the input, with buttons to copy it to the clipboard or download it as a file. Copy is quickest for pasting into code; download is better when the result is large.

What CSV format does it accept?

Comma-separated CSV with a header row as the first row — the format spreadsheets export by default. Quoted fields are supported, so commas, quotes and line breaks inside a field convert correctly.