CSV to JSON Converter

By Asira Tools Team · Last updated 20 November 2026

Paste CSV data from a spreadsheet and get clean JSON back — with headers as keys, quoted commas handled correctly.

Advertisement

CSV to JSON Converter

3 rows converted
Columns3 columns: name, age, city

Your data is processed entirely in your browser — it is never sent to a server.

How it works:

Each line becomes one row. Commas split fields, except inside double quotes — a quoted field may contain commas, line breaks, and doubled quotes ("" means one literal quote). With headers on, the first row becomes the object keys.

What Does a CSV to JSON Converter Do?

A CSV to JSON converter turns tabular data — the kind you export from a spreadsheet, a database, or a survey tool — into JSON, the format that web apps and APIs use. A CSV file is a grid of rows and columns separated by commas; JSON is a structured list of objects. The converter reads the grid and rebuilds it as an array of objects, using the header row as the keys, so the data is ready to paste into code, send to an API, or import into a tool that speaks JSON.

This conversion comes up constantly in real work. A marketing list lives in a spreadsheet but the email tool wants JSON. A product catalogue is maintained in Excel but the website's search index takes JSON. A researcher downloads survey results as CSV and the analysis script expects JSON. Doing the conversion by hand for more than a handful of rows is slow and error-prone; a converter does it in one step, with the quoting rules handled properly.

How to Use This Converter

Paste your CSV into the input box. The JSON output appears immediately, formatted with 2-space indentation. Leave "First row contains headers" checked when the first line names the columns — the usual case for spreadsheet exports — and each row becomes an object with those names as keys. Uncheck it when the CSV has no header row, and the output is an array of arrays instead, with the data untouched.

Everything happens in your browser: the data you paste is never uploaded to a server. That matters because CSV exports often contain names, email addresses, or internal figures that should not be pasted into a tool that phones home. You can verify this by converting with your network disconnected — the tool keeps working, because the work is local.

How CSV Quoting Works

CSV looks simple — values separated by commas, one row per line — but the quoting rules are what make it tricky. A field that contains a comma must be wrapped in double quotes, or the comma would be mistaken for a separator: "Alan, Jr.",41,Manchester is three fields, not four, because the comma inside the quotes belongs to the name. A field that contains a double quote escapes it by doubling it: "She said ""hello"" loudly" is one field whose value is She said "hello" loudly. And a quoted field may even contain a line break, so a row can span several lines.

This converter implements those rules properly. A naive conversion that just splits each line on commas breaks the moment a name, an address, or a note contains a comma — which is most real-world data. The parser here tracks whether it is inside quotes, treats doubled quotes as a single literal quote, and only ends a field on a comma outside quotes. The default example shows this: the row "Alan, Jr.",41,Manchester converts to an object with the name Alan, Jr. intact.

Worked Example

Take this small CSV with a header row:

name,age,city
Ada,36,London
Grace,85,New York
"Alan, Jr.",41,Manchester

With headers on, the converter produces an array of three objects. Each object has the keys name, age, and city, and the values are the cells from that row. Ada becomes {"name": "Ada", "age": "36", "city": "London"}; Grace becomes {"name": "Grace", "age": "85", "city": "New York"}; Alan becomes {"name": "Alan, Jr.", "age": "41", "city": "Manchester"}. Note that every value is a string in the output — CSV has no types, so the converter keeps the values exactly as written rather than guessing which ones are numbers. If your code needs numbers, convert the strings after importing.

With headers off, the same input becomes an array of four arrays, including the header row as data: [["name", "age", "city"], ["Ada", "36", "London"], ...]. That shape is useful when the first row is data rather than labels, or when you want to handle the headers yourself in code.

What to Check Before Converting

Match the delimiter. This converter expects commas. Some tools export with semicolons (common in European locales, where the comma is a decimal separator) or tabs. If your data uses semicolons, re-export it with commas, or replace the semicolons first — otherwise each whole row becomes a single field.

Check for a header row. If the first row is data and you leave headers on, the first row disappears into the key names and you lose a record. If the first row is headers and you turn headers off, the header names appear as a data row. The row count in the status line is a quick check: with headers on, the count is one less than the number of lines.

Watch for ragged rows. A row with fewer fields than the header gets empty strings for the missing keys; a row with extra fields has the extras dropped when headers are on. Both are usually signs of a quoting problem upstream — a missing quote can merge two rows into one. If the row count looks wrong, check the quotes in the source file.

Expect strings, not numbers. CSV stores everything as text, so ages, prices, and dates all arrive in the JSON as strings. That is deliberate: guessing types would turn a product code like "007" into the number 7 and a date like "2026-01-05" into something unexpected. Convert types in your own code, where you know what each column means.

Tips for Clean Conversions

Clean the data in the spreadsheet first. Remove blank rows, merged cells, and summary rows at the bottom before exporting. A totals row becomes a data record in the JSON, and a blank row in the middle becomes an object of empty strings. This converter skips fully blank lines, but a row with a single space in one cell is not blank — it is data.

Keep header names simple. Headers become JSON keys, so a header like "First Name" becomes the key "First Name" — valid JSON, but awkward in code. Rename headers to single words (firstName, first_name) in the spreadsheet before exporting, and the JSON is immediately usable.

Validate the output. The JSON this converter produces is always valid, but it is worth checking the shape — the row count, the column list, and a sample record — before pasting it into your project. The JSON formatter can reformat or minify the output if you need a different indentation.

Common Mistakes to Avoid

The most common mistake is splitting on commas without respecting quotes. Any tool or snippet that does line.split(",") will break on real data the first time a field contains a comma — an address, a name with a suffix, a note with a list in it. Always use a parser that understands quoting, whether it is this converter or a proper CSV library in your language.

Another frequent error is assuming the output numbers are numbers. Because CSV has no types, "36" stays the string "36" in the JSON. Code that adds two ages from the converted data will concatenate strings ("36" + "85" = "3685") instead of adding numbers (121) unless it converts the values first. Convert explicitly, and check for empty strings, which convert to zero or NaN depending on the language.

Finally, remember that CSV has no standard for encoding. A file saved in a legacy encoding can garble accented characters when pasted. If names with accents look wrong in the output, re-save the source as UTF-8 and paste again. For encoding text safely for transport, see the Base64 encoder; for counting the words in any text, the word counter.

Advertisement

Frequently Asked Questions

Does this converter handle commas inside fields?

Yes. Fields wrapped in double quotes may contain commas, line breaks, and doubled quotes, following the standard CSV quoting rules. For example, "Alan, Jr.",41,Manchester converts to one object with the name Alan, Jr. intact.

Why are numbers in the output shown as strings?

CSV has no data types — every cell is text. The converter keeps values exactly as written rather than guessing, so "36" stays the string "36". Convert to numbers in your own code, where you know what each column means.

What happens if a row has fewer columns than the header?

Missing values become empty strings in that row's object. Extra values beyond the header count are dropped. Both usually signal a quoting problem in the source file, so check the quotes if the row count looks wrong.

Can I convert CSV without a header row?

Yes — uncheck "First row contains headers" and the output is an array of arrays, with every row (including the first) kept as data. Column names are not generated; each row is a plain list of values.

Is my CSV data sent to a server?

No. The conversion runs entirely in your browser. Your data never leaves your device, so it is safe to convert spreadsheets containing names, email addresses, or internal figures.