CSV to JSON Converter

Paste CSV data and get pretty-printed JSON — supports delimiters, header toggle, and value trimming

Input & Settings

Try a sample:

JSON Output

Output appears here

Paste CSV above or pick a sample

Examples

CSV with headers → array of objects

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

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

With the 'First row is header' toggle on, each subsequent row maps to a JSON object whose keys come from the header row.

Headerless CSV → array of arrays

Alice,30,New York
Bob,25,Boston

// Output:
[
  ["Alice", "30", "New York"],
  ["Bob",   "25", "Boston"]
]

With headers disabled, every row becomes a plain array of strings, preserving the original column order.

Details

This tool uses the PapaParse library to reliably parse CSV text in your browser. When 'First row is header' is enabled, each data row becomes a JSON object keyed by the header names. When disabled, rows become plain arrays. Auto-delimiter detection picks the right separator automatically, or you can force comma, semicolon, or tab. The trim option strips leading and trailing whitespace from every value before serialisation. All processing happens locally — your data never leaves your browser.

    Examples

    Convert a three-column CSV with a header row

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

    Each data row becomes an object keyed by the first row, and values remain strings because dynamic typing is disabled.

    Preserve commas and escaped quotes inside quoted fields

    Input
    id,name,note
    1,Alice,"Hello, world"
    2,Bob,"Uses ""quotes"""
    Output
    [
      {
        "id": "1",
        "name": "Alice",
        "note": "Hello, world"
      },
      {
        "id": "2",
        "name": "Bob",
        "note": "Uses \"quotes\""
      }
    ]

    A CSV-aware parser keeps the comma inside the first note and converts doubled CSV quotes into literal quote characters.

    About this tool

    CSV (Comma-Separated Values) is the most widely used tabular data format for spreadsheets, databases, and data exports. JSON (JavaScript Object Notation) is the dominant format for APIs and modern web applications. Converting between the two is a daily task for developers, data analysts, and backend engineers.

    This tool uses PapaParse — the fastest and most reliable CSV parser for JavaScript — to handle edge cases like quoted fields containing commas, escaped characters, and mixed line endings. The result is always pretty-printed, valid JSON that you can paste directly into your code or API payload.

    All processing happens locally in your browser. No data is uploaded to any server, making the tool safe for confidential datasets, internal CSVs, and personally identifiable information.

    How to use

    1. Convert a CSV with headers

      Paste your CSV (or pick a sample chip), keep 'First row is header' on, then click Convert to JSON. Each data row becomes a JSON object keyed by the header values.

    2. Parse a headerless CSV as arrays

      Toggle 'First row is header' off before converting. Every row is output as a plain JSON array, useful when the CSV has no column names.

    3. Use a custom delimiter

      Open the Delimiter dropdown and choose Auto-detect, Comma, Semicolon, or Tab to match your file's separator.

    Use cases

    Preparing spreadsheet exports for an API

    Turn a header-based CSV export into an array of objects that can be reviewed, copied, and sent as a JSON request body.

    Creating seed data and test fixtures

    Convert a small table maintained in a spreadsheet into readable JSON fixtures for unit tests, demos, and local database seeds.

    Inspecting delimited vendor data

    Auto-detect commas or select semicolons or tabs, then inspect how quoted fields and empty values map into JSON before writing an importer.

    Converting headerless machine output

    Disable the header option to preserve each record as an array when column names are absent or supplied by a separate schema.

    Output shape by mode

    ModeJSON output
    Header on[{"name":"Alice","age":"30"}] — array of objects keyed by header
    Header off[["Alice","30"]] — array of string arrays
    Trim onLeading/trailing whitespace removed from every value

    Common mistakes

    Mistake:Splitting every line on commas.

    Fix:Use a CSV parser that understands quoted fields, embedded commas, doubled quotes, and line breaks. A plain split(',') corrupts valid RFC 4180-style records.

    Mistake:Ignoring a byte order mark or using the wrong text encoding.

    Fix:Decode the source with its declared charset and remove a leading UTF-8 BOM when necessary before interpreting header names, otherwise the first key may contain an invisible character or text may be garbled.

    Mistake:Assuming the first record is always a header.

    Fix:Confirm the source contract. Turn the header option off for raw row data, or supply validated column names separately when the first row is ordinary data.

    Mistake:Expecting numeric, boolean, or null JSON values automatically.

    Fix:This converter intentionally preserves CSV fields as strings. Apply schema-aware coercion after conversion so values such as 00123, false, and empty fields are not silently misinterpreted.

    Frequently asked questions

    References & standards