CSV to JSON

Turn CSV rows into a JSON array, with header detection and custom delimiters.

  • Runs in your browser
  • Free, no sign-up
Paste CSV to start

About the CSV to JSON

CSV is how spreadsheets, databases and reporting tools export data. JSON is what web apps, APIs and JavaScript code expect. The CSV to JSON converter turns one into the other: paste a CSV export or open a .csv file, and each row becomes a JSON object with the column headers as keys.

It reads real-world CSV correctly. Quoted fields with commas or line breaks inside them, doubled quotes, semicolon-separated files from European versions of Excel, tab-separated data and files with a byte order mark all work. The delimiter is detected for you, and numbers, true, false and null become real JSON values instead of text.

You can choose the shape of the result: a list of objects, a list of arrays, one array per column, or an object keyed by the first column. Column names with dots can become nested objects. The conversion runs in your browser, so your data never leaves your device.

How to use it

  1. Add your CSVPaste it into the CSV box, drop a .csv, .tsv or .txt file onto it, or use Open. Sample loads a small contact list.
  2. Check the delimiterDetect automatically works for most files. If the columns look wrong, choose comma, semicolon, tab or pipe yourself.
  3. Pick the output shapeArray of objects is the most common. You can also choose Array of arrays, Object of columns or Object keyed by first column.
  4. Set the optionsDecide whether the first row is the header, whether to detect numbers and true/false, whether to trim spaces and whether to nest keys with dots.
  5. Copy or downloadThe status line shows how many rows and columns were read. Copy the JSON or download it as data.json.

Key features

Proper CSV parsing

Follows the usual CSV rules: quoted fields can contain commas, line breaks and quotes written as two quotes ("").

Delimiter detection

Looks at the first 20 lines and picks the comma, semicolon, tab or pipe that splits them most consistently.

Real JSON types

Numbers, true, false and null become JSON values. Values that would lose information, like 02134 or very long IDs, stay as text.

Four output shapes

Objects for APIs, arrays for compact data, columns for charts, or an object keyed by ID for quick lookups.

Nested keys

With nesting on, a column called address.city becomes "address": {"city": ...}.

Private by design

Your file is read and converted in your browser. Nothing is uploaded.

Examples

Converting a contact list

The Sample button loads this CSV:

id,name,email,age,active,address.city
1,Ana Silva,ana@example.com,34,true,Lisbon
2,"Okafor, Mia",mia@example.com,28,false,Lagos
3,Lee Chen,,41,true,"New York"

The status line reads 3 rows × 6 columns, comma separated. The first object looks like this:

{
  "id": 1,
  "name": "Ana Silva",
  "email": "ana@example.com",
  "age": 34,
  "active": true,
  "address.city": "Lisbon"
}

"Okafor, Mia" keeps its comma because it is quoted, and Lee Chen's empty email becomes an empty string. Turn on nesting and the last key becomes "address": {"city": "Lisbon"}.

The four output shapes

Here is the same sample, minified, in each shape (only the start is shown):

Array of objects (292 bytes):

[{"id":1,"name":"Ana Silva","email":"ana@example.com",...},...]

Array of arrays (194 bytes), with the header as the first array:

[["id","name","email","age","active","address.city"],[1,"Ana Silva",...],...]

Object of columns (198 bytes):

{"id":[1,2,3],"name":["Ana Silva","Okafor, Mia","Lee Chen"],...}

Object keyed by first column (304 bytes):

{"1":{"id":1,"name":"Ana Silva",...},"2":{...},"3":{...}}

How values are typed

CSV valueJSON value
77
19.9019.9
1e31000
nullnull
02134"02134"
TRUE"TRUE"
(empty)""

ZIP codes with a leading zero stay as text, and so do integers too long to store exactly, such as 12345678901234567890, so nothing is lost. Only lowercase true, false and null are converted.

Semicolon files from Excel

In many countries, Excel saves CSV with semicolons and decimal commas:

name;price
Tea;1,50
Coffee;2,25

The converter detects the semicolon and reads 2 rows × 2 columns. The prices stay as text, "1,50" and "2,25", because a comma is not a decimal point in JSON.

Tips

  • Export from Excel or Google Sheets as "CSV UTF-8" so accented letters and symbols come through correctly.
  • Turn off "Detect numbers, true/false and null" when every value must stay text, for example product codes, phone numbers or IDs that a system expects as strings.
  • Name your columns with dots, such as address.street and address.city, and turn on nesting to get grouped objects without editing the JSON by hand.
  • Use Object keyed by first column when your first column holds unique IDs. Your code can then look up a record with data["42"] instead of searching a list.
  • If the status line says some rows have a different number of fields, look for an unquoted comma inside a value or a missing column in those rows.

Common mistakes and limits

  • Unquoted commas inside valuesA value like Smith, John needs quotes around it in CSV ("Smith, John"). Without them it is read as two fields and the columns shift.
  • Losing extra fieldsWhen a row has more fields than the header, the extra fields are left out of the objects. The status line warns you when rows do not match the header.
  • Duplicate IDs with the keyed shapeObject keyed by first column keeps only the last row for each key. If two rows share an ID, the first one is replaced without a warning.
  • Expecting decimal commas to become numbersJSON numbers use a period, so 1,50 stays the text "1,50". Change the decimal separator in your spreadsheet before exporting if you need numbers.
  • Forgetting the header settingIf your file has no header row, turn off "First row is the header". Otherwise the first data row is used as the keys and goes missing from the results.

Frequently asked questions

How do I convert CSV to JSON?
Paste the CSV or open the file. With the default settings, each row becomes a JSON object whose keys are the column headers. Copy the result or download it as data.json.
Does it handle commas and line breaks inside values?
Yes, as long as the value is in double quotes, which is how Excel, Google Sheets and most programs export it. A quote inside a quoted value is written as two quotes.
What if my file uses semicolons or tabs?
Detect automatically recognizes comma, semicolon, tab and pipe. You can also choose the delimiter yourself from the list.
Why are some numbers kept as text?
Values with a leading zero, like 02134, and integers too long to store exactly keep their text form, so ZIP codes and long IDs are not changed.
What happens to empty cells?
An empty cell becomes an empty string (""). A cell that is missing because the row is too short becomes null.
What if two columns have the same name?
The second one gets _2 added, the third _3, and so on, so no data is overwritten. An empty header becomes column1, column2 and so on, by position.
Can I convert JSON back to CSV?
Yes. Use the JSON to CSV converter, which turns an array of objects back into rows and columns.
Is my data uploaded?
No. The file is read and converted in your browser. Nothing is sent to a server, and files up to 10 MB can be opened.