ModernCalcs

CSV to JSON Converter

Parse CSV into a JSON array of objects. Header row becomes object keys. Numbers are auto-detected. Supports comma, semicolon, tab, and pipe delimiters.

CSV Input

JSON Output

[
  {
    "name": "Alice",
    "age": 30,
    "city": "New York",
    "department": "Engineering",
    "salary": 95000
  },
  {
    "name": "Bob",
    "age": 25,
    "city": "San Francisco",
    "department": "Design",
    "salary": 78000
  },
  {
    "name": "Charlie",
    "age": 35,
    "city": "Austin",
    "department": "Marketing",
    "salary": 82000
  },
  {
    "name": "Diana",
    "age": 28,
    "city": "Boston",
    "department": "Engineering",
    "salary": 91000
  }
]

CSV to JSON: Parse Tabular Data for APIs and Apps

CSV is the most common export format from spreadsheets, databases, and data pipelines. This converter parses your CSV — handling quoted fields, escaped characters, and multiple delimiters — and outputs a clean JSON array of objects ready for APIs, JavaScript apps, or data processing scripts.

Formula
headers = row[0] data = rows.slice(1).map(row => Object.fromEntries(headers.map((h, i) => [h, autoType(row[i])])) )

autoType() converts numeric-looking strings to JSON numbers. Empty cells remain empty strings.

RFC 4180 CSV Parsing

The parser follows RFC 4180 — fields can be wrapped in double quotes to contain commas, newlines, or escaped double-quote characters (""). This means CSV exports from Excel, Google Sheets, and most databases are handled correctly without data corruption.

Automatic Number Detection

Any cell value that JavaScript's Number() can parse (integers, decimals, scientific notation) is output as a JSON number rather than a string. This means age, salary, and quantity columns arrive as numbers without manual post-processing.

Header and No-Header Modes

When 'First row is header' is enabled (default), each row becomes a JSON object keyed by the header row. When disabled, each row is output as a plain JSON array, giving you an array of arrays — useful for matrix data without named columns.

Practical Examples

Converting a CRM Export

Turn a contacts.csv export into a JSON array ready to POST to an API.

  • 1.Paste or drag in the CSV export
  • 2.Verify comma delimiter is selected (default)
  • 3.Ensure 'First row is header' is checked
  • 4.Copy the JSON output and use in your API call or script

Supported Delimiters

  • Comma (,) — default for most CSV files
  • Semicolon (;) — common in European locales
  • Tab (\t) — TSV files and Excel default exports
  • Pipe (|) — used in log files and some DB exports

Good Use Cases

  • Converting spreadsheet exports for REST APIs
  • Preparing data for JavaScript array manipulation
  • Transforming database dumps for JSON-based tools
  • Seeding test fixtures from human-readable CSV

Frequently Asked Questions

Does this handle quoted fields with commas inside?

Yes. The parser follows RFC 4180 — fields wrapped in double quotes can contain commas, newlines, and escaped double quotes ("") without being split incorrectly.

How are numbers detected?

Any field that parses as a valid JavaScript number (via Number()) and is not empty is output as a JSON number rather than a string. Empty fields remain empty strings.

What happens when there is no header row?

When 'First row is header' is unchecked, every row is output as a JSON array rather than an object. The result is an array of arrays.

What delimiters are supported?

Comma (,), semicolon (;), tab (\t), and pipe (|). Select the one matching your file before converting.