·5 min read·Blog

How to Convert CSV to JSON Free Online (With Real Examples)

CSV exports from Excel, Google Sheets, and databases need to be JSON for most APIs and JavaScript apps. Here's how to convert them instantly — and what to do with commas inside quoted fields.

What the conversion produces

A CSV like this:

name,email,age,active
John Doe,john@example.com,30,true
Jane Smith,jane@example.com,25,false

Becomes a JSON array of objects, one per row, using the header row as property names:

[
  {
    "name": "John Doe",
    "email": "john@example.com",
    "age": "30",
    "active": "true"
  },
  {
    "name": "Jane Smith",
    "email": "jane@example.com",
    "age": "25",
    "active": "false"
  }
]

Notice: all values are strings by default. CSV has no type system — everything is text. If you need age as a number and activeas a boolean, you'll need to handle type coercion after conversion.

Convert any CSV file using the free CSV to JSON converter — paste CSV or upload a file, get formatted JSON instantly.

Handling the common problems

Commas inside field values

RFC 4180 (the CSV standard) handles commas inside field values by wrapping the field in double quotes:

name,address,city
John,"123 Main St, Apt 4B",Springfield

The addressfield contains a comma but is correctly parsed as one value because it's quoted. Any proper CSV parser handles this — but if you're writing a simple split-on-comma parser yourself, you'll miss this and get the wrong result. Use the converter or a proper library.

Quotes inside quoted fields

name,bio
John,"He said ""hello"" to everyone"

Double-quote characters inside a quoted field are escaped by doubling them (""). The resulting JSON:

{"name": "John", "bio": "He said "hello" to everyone"}

Different delimiters (TSV, semicolons)

Not all "CSV" files use commas. European locales often export with semicolons (;) because commas are used as decimal separators. Tab-separated values (TSV) use tabs.

The converter lets you specify the delimiter — choose comma, semicolon, tab, or pipe (|) depending on your source file.

Type conversion after parsing

Since CSV values are all strings, you'll often need to convert types in code. In JavaScript:

const raw = [
  { name: "John", age: "30", active: "true" }
];

const typed = raw.map(row => ({
  ...row,
  age: Number(row.age),
  active: row.active === 'true'
}));
// Result: { name: "John", age: 30, active: true }

For large datasets, consider using a library like Papa Parse (browser) or fast-csv (Node.js) which supports type inference options.

Converting in code (no tool needed)

If you need to convert CSV to JSON programmatically:

JavaScript (browser/Node.js, simple case):

function csvToJson(csv) {
  const lines = csv.trim().split('\n');
  const headers = lines[0].split(',');
  return lines.slice(1).map(line => {
    const values = line.split(',');
    return headers.reduce((obj, header, i) => {
      obj[header.trim()] = values[i]?.trim() ?? '';
      return obj;
    }, {});
  });
}

Note: this simple approach doesn't handle quoted fields with commas inside them. For production use, use Papa Parse or a proper CSV library.

Python:

import csv, json

with open('data.csv', newline='') as f:
    reader = csv.DictReader(f)
    data = list(reader)

print(json.dumps(data, indent=2))

Common use cases

  • Google Sheets → API payload: Export as CSV → convert to JSON → POST to a REST API that expects JSON
  • Excel data → database seed: Convert CSV export to JSON for seeding a database via a script
  • Product catalog import: Many e-commerce platforms accept JSON imports — convert your spreadsheet product data
  • Data analysis prototype: Convert CSV data to JSON to use with JavaScript charting libraries (Chart.js, D3.js) that expect JSON arrays

Related tools


Written by Achraf A., founder of TheFreeAITools.

Browse by category

Not sure which tool you need? Start with a category.

Everything you can do — for free

No software to buy. No account to create. Just open a tool and get it done.

Work with images

Compress photos before sending them by email, resize pictures for social media, remove backgrounds, or pick the perfect color for a design project — all without installing any app.

Edit and format text

Count words and characters in an essay, compare two documents side by side, convert text to different formats, or generate placeholder text for a presentation.

Stay safe online

Create a strong unique password in one click, check how secure a password is, encode or decode data, and generate secure tokens — your data never leaves your device.

Calculate anything

BMI, loan repayments, unit conversions, date differences, and dozens of other everyday calculations — no spreadsheet or formula knowledge required.

The Free AI Tools is a free collection of 221+ online tools that work directly in your web browser — no download, no installation, no account required. Whether you need to compress an image for email, count words in an essay, generate a strong password, create a QR code for your business, or format JSON for development — you will find a simple, free tool here.

Every tool is privacy-first: your files, text, and data never leave your device. Tools cover image editing, text processing, developer utilities, security & encoding, SEO & web, design & CSS, and more.

☕ Support Us