CSV to JSON Converter

Convert CSV data to a JSON array of objects instantly in your browser. First row becomes the keys.

Drag & drop a CSV file here, or

Supports .csv and .txt files

?
?


                
            

Quick answer

A CSV-to-JSON converter reads the first row as column headers and turns every following row into a JSON object keyed by those headers, collecting them into an array. This tool is RFC 4180 compliant: it handles quoted fields containing commas, escaped quotes and real line breaks, auto-detects comma, semicolon, tab or pipe delimiters, and converts numbers and booleans to real JSON types — all in your browser, nothing uploaded. Paste CSV, click Convert to JSON, then copy or download as JSON or NDJSON.

How This Tool Converts CSV to JSON

Worked example

This CSV packs in every case that trips up naive parsers at once: an embedded comma, escaped quotes, a real line break inside a quoted field, a leading-zero code, a boolean and an empty trailing cell.

Input CSV

name,age,zip,active,note
Alice,30,007,true,"Likes ""tea"", coffee
and long walks"
Bob,25,90210,false,

Output JSON

[
  {
    "name": "Alice",
    "age": 30,
    "zip": "007",
    "active": true,
    "note": "Likes \"tea\", coffee\nand long walks"
  },
  {
    "name": "Bob",
    "age": 25,
    "zip": 90210,
    "active": false,
    "note": ""
  }
]

What happened

Edge cases & gotchas

When to Use CSV to JSON

Frequently Asked Questions

How does the CSV to JSON converter work?

The first row of your CSV is treated as the header row and becomes the JSON object keys. Each subsequent row becomes a JSON object in the output array.

Is my CSV data sent to a server?

No. All conversion happens entirely in your browser using JavaScript. Your data never leaves your device.

Does it handle commas inside CSV fields?

Yes. Fields wrapped in double quotes are handled correctly, including commas and escaped double quotes ("") inside quoted fields.

Can I upload a CSV file instead of pasting?

Yes. Click "Choose File" or drag and drop a .csv or .txt file onto the drop zone. The file contents are loaded into the editor automatically.

Does my CSV need a header row?

Not necessarily. By default the first row is treated as the header row and its values become the JSON keys. If your data has no header, untick "First row is a header" and the converter will either generate col1, col2, col3 keys or output each row as a plain array, whichever you choose.

Are numbers and booleans detected automatically?

Yes, when "Detect numbers and booleans" is enabled (it is on by default). A cell containing 42 becomes the number 42, true and false become real booleans, and the word null becomes null. Values that cannot survive the conversion are deliberately left as strings: leading zeros such as 007, integers larger than JavaScript can represent exactly, and numbers with a leading plus sign. This keeps IDs, zip codes and phone numbers intact. Turn the option off to keep every value as a string.

Does it support line breaks inside a quoted CSV field?

Yes. The parser reads the file as a single character stream and tracks whether it is inside a quoted field, so a real newline inside quotes is preserved as part of that value rather than splitting the record. This is the behaviour RFC 4180 specifies. Commas, custom delimiters and escaped double quotes inside quoted fields are handled correctly too.

What happens if two columns have the same header name?

JSON object keys must be unique, so the converter renames the repeat instead of dropping it. A second column named "id" becomes "id_2", a third becomes "id_3", and a notice tells you the rename happened. No column is silently lost. Rename the headers in your source data if you want different names.

Can it convert semicolon or tab delimited files?

Yes. The delimiter is auto-detected from the header row by default, covering comma, semicolon, tab and pipe, and you can also set it explicitly or enter a custom character. Semicolon files are common because Excel in many European locales uses a semicolon as its list separator; tab separated (.tsv) files work the same way.

Can I produce nested JSON instead of flat objects?

Yes. Enable "Expand nested keys" and a header such as user.name becomes a nested object {"user":{"name":...}}, while a numeric segment such as items.0.id rebuilds a real array. The separator defaults to a dot and can be changed. This is the exact inverse of the flattening performed by the JSON to CSV tool, so data can round-trip between the two.

Can I export NDJSON instead of a JSON array?

Yes. Choose NDJSON as the output format and each record is written on its own line with no wrapping array. This is the format expected by tools such as jq, BigQuery, Elasticsearch bulk import and many log pipelines. Minified single-line JSON is also available.