CSV to JSON Converter: Fast, Free & Private (No Uploads)

Mirsal Saidu Updated 8 min read

Convert CSV to JSON in your browser without uploading the file. See each setting, a real input and output example, and how the converter types your values.

CSV to JSON Converter: Fast, Free & Private (No Uploads)

Customer lists and finance exports are the kind of CSV files you shouldn't paste into a CSV to JSON converter that sends them to someone else's server. This guide shows how to turn CSV into JSON in your browser with our converter, what each setting does, and which type conversions to check before you use the output.

How do you convert CSV to JSON without uploading your data?

Use a converter that does the work in your browser, like our Online CSV to JSON Converter. It parses the text you paste with JavaScript running in the page and writes the JSON into the output box. The page makes no network request with your data, which you can confirm in your browser's DevTools Network tab while you click Convert. Because nothing is sent, nothing can be logged by a third-party server or intercepted on the way.

How to use the CSV to JSON converter, step by step

  1. Open the CSV / JSON converter. CSV → JSON is the default mode; the other button switches to JSON → CSV.
  2. Paste your CSV into the Input CSV box. The tool takes pasted text rather than file uploads, so open a .csv file in a text editor and copy its contents. For a spreadsheet, see the section on Excel and Google Sheets below.
  3. Choose the delimiter: comma (the default), semicolon, tab or pipe. The tool does not guess it.
  4. Leave "First row is header" ticked to use the first row as JSON keys. Untick it and every row, including the first, comes out as an array.
  5. Pick Array of Objects (one object per row) or Array of Arrays, and keep "Prettify output" ticked for 2-space indentation.
  6. Click Convert. A status line confirms the size, for example ✓ Converted 2 rows × 6 columns to JSON. Click Copy to put the JSON on your clipboard.

Example: what goes in and what comes out

id,name,zip,price,in_stock,notes
1,"Smith, John",02134,3.50,true,"He said ""hi"""
2,Ada,10001,12,false,

With the default settings, the converter returns:

[
  {
    "id": 1,
    "name": "Smith, John",
    "zip": 2134,
    "price": 3.5,
    "in_stock": true,
    "notes": "He said \"hi\""
  },
  {
    "id": 2,
    "name": "Ada",
    "zip": 10001,
    "price": 12,
    "in_stock": false,
    "notes": ""
  }
]

The quoted comma in "Smith, John" stays inside the name, and the doubled quotes in the notes become one quote, which is how RFC 4180 says quotes inside a quoted field are written. The empty last field becomes an empty string. Numbers and lowercase true/false become real JSON numbers and booleans, and that is also why ZIP code 02134 lost its leading zero.

How the converter types your values

CSV has no data types; every cell is text. The converter guesses a type for each cell, and these are the results it gives:

CSV cellJSON valueRule
2828Plain digits become a number
3.503.5Trailing zeros disappear
0077Leading zeros disappear
"42" (quoted)42Quotes in CSV do not mark a value as text
12345678901234567"12345678901234567"Numbers written with 16 or more characters stay text
1e5"1e5"Exponents and a leading + stay text
truetrueLowercase true, false and null are converted
TRUE"TRUE"Any other spelling stays text
(empty)""Empty cells become empty strings
(missing)nullShort rows are padded with null

The 16-character limit protects long IDs. JavaScript numbers are exact only up to 9,007,199,254,740,991 (2**53 - 1), the same limit RFC 8259 gives for integers that every JSON parser will read identically, so a 17-digit order number would otherwise be silently rounded. There is no switch to turn the typing off. If you need ZIP codes, phone numbers or SKUs with leading zeros kept as text, use the script in the FAQ below, which leaves every value as a string.

Handling nested JSON from a flat CSV

The converter does not build nested objects. It uses each header exactly as written, so a column named user.address.city becomes a key with dots in it:

[
  {
    "user.name": "Ada",
    "user.address.city": "London"
  }
]

If you need real nesting, convert first, then run a few lines of JavaScript in your browser console or Node.js. Put the converter's output in output:

const rows = JSON.parse(output);
const nested = rows.map(row => {
  const obj = {};
  for (const [path, value] of Object.entries(row)) {
    const keys = path.split('.');
    let node = obj;
    for (const k of keys.slice(0, -1)) node = node[k] ??= {};
    node[keys.at(-1)] = value;
  }
  return obj;
});
console.log(JSON.stringify(nested, null, 2));

For the row above, that prints:

[
  {
    "user": {
      "name": "Ada",
      "address": {
        "city": "London"
      }
    }
  }
]

The opposite direction doesn't flatten either. In JSON → CSV mode, a nested object or array is written into a single cell as JSON text, so {"address": {"city": "London"}} becomes the cell "{""city"":""London""}". If your data is mostly nested, it may not belong in CSV at all; JSON vs CSV: which format to use covers that choice.

How to keep leading zeros, prices and long IDs intact

Our CSV to JSON converter has no option to switch off type guessing, and putting the value in quotes in the CSV doesn't help, because the quotes are removed before the value is typed. A cell stays text only when it isn't a plain number: a letter, a space, a plus sign or a dash inside the value keeps it as text, and so does a number written with 16 or more characters. These cells stayed text:

sku,zip,phone
A-0042,02134-1234,+44 20 7946 0958

while 007123 and 02134 in the same columns became 7123 and 2134. If only one or two columns are affected, convert as normal and repair them afterwards. For US ZIP codes, which always have five digits, a line of JavaScript in the browser console puts the zeros back:

const rows = JSON.parse(output);
rows.forEach(r => r.zip = String(r.zip).padStart(5, '0'));
console.log(JSON.stringify(rows, null, 2));

Padding only works when you know the fixed length. For SKUs, account numbers or anything of varying length, use the Python line in the FAQ, which keeps every value as text. Prices lose trailing zeros (3.50 becomes 3.5), so format them wherever you display them.

Going the other way: JSON to CSV

Click the JSON → CSV button to reverse the direction. The input has to be a JSON array whose items are objects or arrays; a single object such as {"a": 1} stops with the message JSON must be an array. Got object. For an array of objects, the header row lists every key found in any object, in the order the keys first appear, and a missing key or a null becomes an empty cell. This input:

[
  {"id": 1, "name": "Ada", "tags": ["x", "y"], "address": {"city": "London"}},
  {"id": 2, "name": "Smith, John", "zip": "02134", "note": null}
]

produces:

id,name,tags,address,zip,note
1,Ada,"[""x"",""y""]","{""city"":""London""}",,
2,"Smith, John",,,02134,

The comma in "Smith, John" gets the field quoted, the array and the object land in single cells as JSON text, and the string "02134" keeps its zero because it was already text in the JSON. Untick "Include header row" to leave the header out, and pick a semicolon, tab or pipe as the output delimiter if the file is going to a program that expects one.

Converting a CSV file from Excel or Google Sheets

You don't always need to save a file first. When you copy a block of cells in Excel or Google Sheets, the clipboard holds them as tab-separated text, so you can paste straight into the Input CSV box, set the delimiter to Tab and click Convert. To work from a saved file instead:

  • In Excel, use File > Save As and choose "CSV UTF-8 (Comma delimited)". In regions where the comma is the decimal separator, Excel often writes semicolons instead, so check the first line and set the delimiter to match.
  • In Google Sheets, use File > Download > Comma Separated Values (.csv). Only the current sheet is exported.

Then open the file in a plain text editor and copy everything. Spreadsheets often drop leading zeros before the CSV is written, so check the raw text if a value looks wrong.

CSV to JSON online, offline and in code

Most CSV to JSON online tools look alike; they differ in where the parsing happens and what it does to your values. Our converter's code is part of the page, so once the page has loaded you can convert CSV to JSON with the network switched off. For a repeat job such as a nightly export, a script fits better: the Python one-liner in the FAQ handles large files and keeps every value as text. To see what changed between two runs of the same export, paste both outputs into the diff checker.

Problems the output will show you

  • Wrong delimiter. A semicolon file converted with the comma setting reports 1 column and produces keys like "name;city". Switch the delimiter to semicolon and convert again.
  • Uneven rows. A row with fewer cells than the header gets null for the missing columns; cells beyond the header's last column are dropped.
  • Repeated header names. With two columns called name, the second one wins: Ada,Lovelace becomes {"name": "Lovelace"}.
  • Line breaks inside quoted fields are kept, as RFC 4180 allows, and appear in the JSON as \n.

To check the JSON before you use it elsewhere, paste it into the JSON formatter, which runs in the browser too. If it reports a syntax error after you edited the output by hand, common JSON errors and their fixes explains each message. For a refresher on objects, arrays and value types, read what JSON is.

Frequently asked questions

Is there a file size limit for browser-based conversion?

The converter's code sets no limit. The text is held in your browser's memory, so the practical ceiling depends on your browser and machine, and a very large paste makes the text box slow. For big files, a script is more practical. Python's standard library can do it in one line:

python3 -c "import csv, json, sys; print(json.dumps(list(csv.DictReader(sys.stdin)), indent=2))" < data.csv > data.json

That version keeps every value as a string, so 02134 stays "02134".

What delimiters are supported?

Our CSV to JSON converter supports commas, semicolons, tabs and pipes. You choose one from the Delimiter menu; the tool doesn't detect it automatically, so if the output has a single column, the setting is wrong.

Why did my leading zeros disappear?

The converter turns anything that looks like a plain number into a JSON number, and numbers can't keep leading zeros. Quoting the cell in the CSV doesn't prevent it. Convert with the Python line above instead, or fix the affected fields in the JSON afterwards.


Share this article:
Mirsal Saidu

Mirsal Saidu

Digital & Performance Marketer