Dev Tools Convert CSV to JSON Converter
100% client-side · No signup · Free forever

CSV to JSON Converter

Paste CSV rows and get a clean JSON array ready to drop into your API or app.

1
Convert tool
CSV to JSON Converter
Live
CSV Input
JSON Output

Converting CSV to JSON turns the world's oldest tabular format into the modern web's favorite data format. Whether you're importing a spreadsheet export into a Node.js script, feeding a contact list to an HTTP API, or migrating off Excel into a JSON-based config system, this tool gives you clean, predictable JSON from any well-formed CSV. The parser auto-detects headers from the first row and respects RFC 4180 quoted fields, so commas-inside-strings and embedded newlines parse correctly.

How CSV to JSON Conversion Works

The parser splits the input on newlines (handling \n, \r\n, and quoted multi-line fields), takes the first row as headers, then maps each subsequent row to an object where keys come from the headers and values come from the row. Quoted fields are unescaped (doubled quotes become a single quote). Empty cells become empty strings; type inference is intentionally NOT done — everything stays a string so you don't get surprised by phone numbers being converted to scientific notation or leading zeros being stripped from IDs.

When to Convert CSV to JSON

  • API ingestion — most REST and GraphQL APIs accept JSON; convert your spreadsheet first.
  • Data seeding — bootstrap a database from a CSV by converting to JSON, then bulk-inserting.
  • Frontend consumption — React, Vue, Svelte apps work better with JSON than parsing CSV in the browser.
  • Config migration — moving from Excel-based configs to a JSON-driven app? Start here.
  • NoSQL imports — MongoDB mongoimport --jsonArray, DynamoDB batch writes, Firebase — all want JSON.

CSV to JSON in Code

function csvToJSON(csv) {
  const [headerLine, ...lines] = csv.trim().split('\n');
  const headers = headerLine.split(',');
  return lines.map(line => {
    const values = line.split(',');
    return Object.fromEntries(
      headers.map((h, i) => [h, values[i] ?? ''])
    );
  });
}
// For RFC 4180 quoted fields, use a proper parser like 'papaparse' or 'csv-parse'.

To go back the other way, use our JSON to CSV converter.

CSV Dialect & Encoding Gotchas

CSV is not a single standard — it's a family of similar formats. Delimiters can be commas, semicolons (common in European locales), tabs (TSV), or pipes. Encoding is usually UTF-8 but Excel exports sometimes default to Windows-1252 or UTF-16 with a BOM. This tool assumes comma delimiter and UTF-8 encoding. If your file uses a different delimiter, find-and-replace it to comma first. If you see ¿¿¿ or garbled characters, re-save the source file as UTF-8.

Frequently Asked Questions

Everything you need to know about the CSV to JSON Converter.

Does it handle quoted CSV fields?

Yes, the parser supports RFC 4180 style quoted fields with escaped quotes.