Skip to main content

CSV to JSON Explained: Quotes, Commas and Types

Updated 3 November 2026 · 4 min read

CSV looks simple, a table saved as plain text, but real files are full of quotes, commas inside cells and numbers that are really codes. This guide shows how each of those becomes JSON, with examples you can paste into the CSV to JSON Converter.

Free toolCSV to JSON ConverterOpen

The basic idea

A CSV file has one row per line, and the cells in a row are split by a separator, usually a comma. With the first row used as the header, each later row becomes one JSON object, with the header cells as its keys:

CSV and the JSON it becomes
name,age,city
Asha,28,Pune
Ravi,35,Delhi

[
  { "name": "Asha", "age": 28, "city": "Pune" },
  { "name": "Ravi", "age": 35, "city": "Delhi" }
]

The real output puts each key on its own line. It is shortened here to keep the example readable.

Quotes: commas, quote marks and line breaks inside a cell

The converter follows the common CSV standard (RFC 4180). A cell wrapped in double quotes can hold the separator, a line break, and a quote mark written twice:

Quoted cells
name,note
Asha,"Pune, Maharashtra"
Ravi,"He said ""hi"""

→ "note": "Pune, Maharashtra"
→ "note": "He said \"hi\""
  • A quote only has this meaning at the very start of a cell. In x"y the quote is just a character and stays in the value.
  • A cell can run over several lines if it is in quotes, such as an address. In the JSON the break becomes \n.
  • If a quote is opened and never closed, nothing is converted. The tool tells you the line where the quote opened, so you can find the missing ".

Separators: comma, semicolon, tab or pipe

Not every CSV uses commas. Excel saves with semicolons on computers with some regional settings, and TSV files use tabs. The converter looks at the first 20 lines, counts each separator outside quotes, and picks the one that appears the same number of times on every line. You can also choose Comma, Semicolon, Tab or Pipe yourself.

Watch for decimal commas. In a semicolon file, 1250,50 is one cell, and because of the comma it is not a valid JSON number, so it stays as the text "1250,50". Change the decimal mark to a dot in the spreadsheet first if you need numbers.

The header row

  • With First row is the header on, the first row gives the keys and every other row becomes an object.
  • An empty header cell gets a name like column_3, so its data is not lost.
  • A repeated header gets _2, _3 and so on: name, name becomes name and name_2.
  • Spaces around cells are trimmed, and empty rows are skipped.
  • With the header option off, there are no keys, so each row comes out as an array of values.

Types: numbers, true/false and empty cells

In CSV everything is text. With Numbers and true/false as values on, the converter turns values that are clearly numbers or true/false into real JSON values. It keeps anything as text that would change if it became a number:

CellJSON valueWhy
2828A plain number
7.57.5A decimal number
true or TRUEtrueA true/false value
(empty)nullAn empty cell
011001"011001"A leading zero would be lost
+919876543210"+919876543210"A phone number with + stays text
1234567890123456"1234567890123456"Over 15 digits, like card numbers and IDs
1e5"1e5"Looks like a code, not a number
True"True"Only true, TRUE, false and FALSE count

One thing to watch: a price like 3.50 becomes the number 3.5, because JSON numbers do not keep trailing zeros. If the exact text matters, turn the option off. Then every cell stays as text, and empty cells become "" instead of null.

Nested keys

Turn on Nested keys and headers with dots become objects inside objects:

Headers with dots, nested keys on
id,address.city,address.pin
1,Surat,395003

[{ "id": 1, "address": { "city": "Surat", "pin": 395003 } }]

Only dots in header names create nesting. Lists inside a cell, such as red;blue, are not split.

Three output shapes

  • Array of objects: one object per row with named fields. This is what most APIs and JavaScript code expect.
  • Array of arrays: every row as a list of values, with the header row as the first list.
  • JSON Lines: one object per line and no surrounding brackets, used for bulk imports and data pipelines. It downloads as a .jsonl file.

For the first two you can pick 2 or 4 spaces, a tab, or minified output with no spaces at all.

The same two rows as JSON Lines
{"name":"Asha","age":28}
{"name":"Ravi","age":35}

Getting CSV out of Excel or Google Sheets

The converter reads CSV, not .xlsx. In Excel choose File > Save as > CSV UTF-8. In Google Sheets choose File > Download > Comma-separated values. Then open that file here, or paste its text. Files up to 10 MB can be opened, and the data is converted in your browser, not uploaded. Dates stay as text exactly as they appear in the file.

If a column of codes such as PIN codes or roll numbers lost its leading zeros, the spreadsheet removed them before saving the CSV. Format that column as text in the spreadsheet, save the CSV again, and convert it once more.

Try it now: CSV to JSON Converter

Paste CSV or open a .csv file and get clean JSON at once: one object per row, with the header row as keys.

Open CSV to JSON Converter