CSV to JSON

Convert CSV to JSON with delimiter detection and header toggle.

CSV Input45 chars
JSON Output
JSON output appears here

Related Tools

Documentation

What is CSV to JSON?

CSV to JSON converts comma-separated rows into a JSON array — either an array of objects keyed by the header row, or an array of plain arrays if the CSV has no header. It's the fastest path from a spreadsheet export to a data structure a script or API can consume directly.

How it works

The tool parses your input with the papaparse library, using { header, skipEmptyLines: true, dynamicTyping: true }. header: true turns the first row into object keys; dynamicTyping converts numeric- and boolean-looking cells into real JSON numbers/booleans instead of leaving everything as strings. The parsed rows are then serialized with JSON.stringify(data, null, 2). Papaparse also handles quoted fields (commas or newlines inside quotes) per the CSV spec, and reports row-level parse errors with a line number so the input panel can highlight exactly where things broke.

Features

  • Toggle between "array of objects" (header row) and "array of arrays" (no header)
  • Automatic type coercion — numeric and boolean-looking cells become real JSON types
  • Quoted-field and embedded-comma support via papaparse
  • Row-level error reporting with the offending line highlighted
  • Copy, download as .json, or load a .csv file directly from disk

Example

Input:

name,age,city
Alice,30,New York
Bob,25,Boston

Output (header row on, 2-space indent):

[
  {
    "name": "Alice",
    "age": 30,
    "city": "New York"
  },
  {
    "name": "Bob",
    "age": 25,
    "city": "Boston"
  }
]

Common errors

Ragged rows (a data row with more or fewer fields than the header) are the most frequent papaparse error, reported with the offending row number. Unbalanced quotes — a stray " that isn't properly closed or escaped as "" — also break parsing partway through a field. Because dynamicTyping is on, a column that's mostly numbers but has one text value (e.g. "N/A") will produce a mixed-type array across rows — decide up front whether that's acceptable for your consumer.

Best practices

Turn off "First row is header" only for genuinely headerless exports — most real-world CSVs (database exports, spreadsheet downloads) include one. If a column should always stay a string (e.g. zip codes or IDs with leading zeros), keep it quoted in the source CSV or fix it up after conversion, since dynamic typing will otherwise strip leading zeros by treating it as a number. For very large files, prefer the Load File button over pasting, since it avoids round-tripping megabytes of text through the textarea.

Frequently Asked Questions

What does "First row is header" control?

When checked, the first CSV row becomes the object keys and the output is an array of objects. Unchecked, every row becomes a plain array, producing an array of arrays instead.

Does it handle quoted fields with commas inside them?

Yes — quoted and escaped fields (e.g. "Smith, John") are parsed correctly per the CSV spec, via the papaparse library.

Are numbers converted automatically?

Yes — numeric-looking cells are converted to actual JSON numbers rather than staying as strings, so "30" becomes 30.

What delimiter does it expect?

Papaparse auto-detects the delimiter (comma, tab, semicolon, or pipe) from the input.

Is my CSV uploaded anywhere?

No — parsing happens entirely in your browser.