Skip to the content

Contact usFree tools · No signup · Files stay on your device

Developer Tools

CSV to JSON: the complete guide to converting spreadsheet data to JSON

CSV to JSON: the complete guide to converting spreadsheet data to JSON

CSV is how spreadsheets, school results portals and bank exports hand over data. JSON is what websites, apps and APIs want. Turning one into the other sounds simple until you meet a comma inside a name, a semicolon-separated file from a European Excel, or a phone number that loses its leading zero. Our free CSV to JSON converter takes care of those cases, shows a preview table, and lists any broken rows by line number.

This guide walks through every option, shows a real conversion, and explains what the warnings mean. It is written for developers and for non-developers who just need their sheet as JSON.

What CSV to JSON does

It reads your CSV text, works out the delimiter, splits it into rows and fields following the standard CSV quoting rules, and writes either an array of objects (one object per row, with the header names as keys) or an array of arrays.

It does not read .xlsx files directly. If your data is in Excel, first save it as CSV, or use Excel to CSV, which does it for you in the browser. And it does not guess dates: 2026-11-20 stays a string.

How to use CSV to JSON, step by step

  1. Open CSV to JSON.
  2. Paste CSV into the box labelled "Paste CSV (comma, semicolon, tab or pipe separated)", or press Open file (.csv, .tsv or .txt), or Sample.
  3. Check the Options: Delimiter, Output, Indent, and the five tick boxes.
  4. Read the "JSON output" panel and the Preview table below it. The stats line shows Rows, Columns, Delimiter, Output size and Time.
  5. If there are problems, Errors and Warnings boxes list them with line numbers.
  6. Press Copy, or Download .json. The file is named after the one you opened, or data.json.

A worked example

Here is a small student list, the kind a coaching centre keeps in Excel:

roll,name,phone,hsc_gpa,address.district,address.upazila,paid
101,"Rahim Uddin",01712345678,4.83,Dhaka,Mirpur,true
102,"Karim, Abdul",01812345678,5.00,Cumilla,Daudkandi,false
103,Nusrat Jahan,01912345678,,Rajshahi,,true

With the default options, the second record becomes:

{
  "roll": 102,
  "name": "Karim, Abdul",
  "phone": "01812345678",
  "hsc_gpa": 5,
  "address.district": "Cumilla",
  "address.upazila": "Daudkandi",
  "paid": false
}

Look at the details. The comma inside "Karim, Abdul" stayed in one value because the field was quoted. The phone number kept its zero. 5.00 became 5, because a real number has no trailing zeros. true and false became booleans. And on the third record, the empty hsc_gpa is "", not null.

Now tick Nest dot headers. The same record then holds "address": { "district": "Cumilla", "upazila": "Daudkandi" } instead of two flat keys.

Every option explained

Delimiter

Auto-detect looks at the first lines of your data and picks the one of comma, semicolon, tab or pipe that splits them into the most consistent number of columns. Once it has decided, the label shows the choice, for example "Auto-detect (Semicolon (;))", and the Delimiter stat repeats it. Override it only if detection gets it wrong, which can happen with a very short file. Excel in countries that write 1,5 for one and a half saves CSV with semicolons, and detection handles that.

Output: Array of objects or Array of arrays

Objects give [{"name":"Rahim","gpa":4.83}], which is what most code expects. Arrays give [["name","gpa"],["Rahim",4.83]]. With a header row, the first inner array is the header itself, kept as text, and the Rows stat does not count it.

Indent

2 spaces, 4 spaces, Tabs or Minified (one line).

First row is header

On by default. The first row supplies the keys. If two headers are the same, the second is renamed with a suffix: a, a gives a and a_2. A blank header becomes column_3 and so on. Untick this when your file has no header; the keys are then column_1, column_2, and every row, including the first, is data.

Convert numbers, booleans & null

On by default. Plain numbers such as 101, 4.83, -3 and 1e3 become numbers. true, false (also TRUE, FALSE, True, False) become booleans, and null or NULL becomes null. Values that look like numbers but would change if converted stay as text: 007, 01712345678, +8801712345678, and whole numbers above 9,007,199,254,740,991. Dates and times are never converted. Untick it to keep every value as a string, for example when you need 5.00 exactly as written.

Trim spaces

Off by default. When ticked, spaces around every value are removed. A value 5 stays text with the spaces when it is off, and becomes the number 5 when it is on. Tick it for hand-typed files where people added spaces after commas.

Skip empty lines

On by default. Blank lines are dropped. If you untick it, each blank line becomes an object with one empty value.

Nest dot headers

Appears only when Output is Array of objects and First row is header is ticked. Headers such as address.district become nested objects. If both a and a.b exist as headers, the nesting would clash, so those keys are kept flat and a warning says so.

What it accepts and its limits

  • Input: CSV or TSV text with a comma, semicolon, tab or pipe as the separator. A byte-order mark at the start is ignored.
  • Quoting: fields wrapped in double quotes can contain the delimiter, line breaks and quotes written twice. The details are in how to handle commas and quotes inside CSV values.
  • Encoding: files you open are read as UTF-8, which is what Excel's CSV UTF-8 option and most tools produce. If your Bangla appears as strange symbols, the file was saved in an older encoding; see how to save Excel as CSV UTF-8 without breaking Bangla.
  • Size: no fixed limit. Above 1 MB the page waits for the Convert button. The preview table shows the first 100 rows, with a title such as "Preview (first 100 of 2,400 rows)". The text box shows the first 200,000 characters of the result.

Privacy

CSV to JSON runs in your browser. Nothing you paste or open is sent to our server, so student records, customer lists and exports can be converted without uploading them anywhere.

Common problems and how to fix them

"Row has 4 fields, expected 3."

A warning with a line number. The row still converts: missing values are left out of the object, and extra values get column_4 style keys. The usual cause is an unquoted comma in a text value, such as 102,Karim, Abdul,Ten in a three-column file. Quote the value, or fix it at the source.

"Unclosed quote"

A field starts with a double quote and never ends. The tool reads the whole rest of the file into that field and shows an error at the line where the quote opened. Find that line and close the quote, or double it if it is a real quote mark.

"Unexpected text after a closing quote"

Something follows a closing quote before the next comma, for example "x"y. The tool keeps the extra text in the field rather than losing it, and warns you.

Everything is in one column, or the keys look like "name;price"

The wrong delimiter was chosen. Set Delimiter yourself to Semicolon (;).

Decimal commas stay as text

In a European-style file, 1,5 is not a valid JSON number, so the value stays the string "1,5". Replace the comma with a dot in the source, or convert it in your code.

A number I wanted as text became a number

Untick Convert numbers, booleans & null, or keep it as a string in code. Leading-zero values are already protected.

Quick checklist

  • Leave Auto-detect on unless the keys look wrong.
  • Use dot headers and Nest dot headers for nested JSON.
  • Check the Warnings box for rows with the wrong number of fields.
  • Keep identifiers as strings; leading zeros already are.
  • Untick Convert numbers if you need exactly what the sheet shows.

Frequently asked questions

Why does my phone number keep its leading zero but my roll number does not?
With Convert numbers, booleans & null ticked, a value such as 101 becomes the number 101, but a value with a leading zero such as 01712345678 stays text, so no digit is lost. Untick the option if you want every value to stay a string.
Why are empty cells empty strings and not null?
An empty cell becomes "" in the JSON, not null. Only the exact text null or NULL in a cell is converted to null.
What does Row has 4 fields, expected 3 mean?
That row has a different number of values than the header. The row is still converted: missing values are left out of the object, and extra ones get names like column_4. The warning gives the line number so you can find the broken row.
How do I get nested JSON from a flat CSV?
Name your headers with dots, such as address.district, and tick Nest dot headers. The option appears only when Output is Array of objects and First row is header is ticked.
How big a file can I convert?
The page sets no fixed limit; it works in your browser memory. Above 1 MB it stops converting as you type and waits for you to press Convert, and the text box previews the first 200,000 characters of the result while Copy and Download give everything.
Found this useful? Share it

Tools in this guide

Main tool

CSV to JSON

Paste CSV or open a file to get clean JSON — an array of objects or arrays — with proper handling of quotes, line breaks, delimiters and data types.

Open tool

JSON to CSV

Turn JSON arrays into a CSV you can open in Excel or Google Sheets.

Open tool

JSON Formatter

Paste messy or minified JSON to get clean, indented output instantly — or minify it for production.

Open tool

Excel to CSV

Save any sheet of an Excel workbook as a CSV file, with the delimiter you need and the values exactly as Excel shows them.

Open tool

Back to all guides & blog