CSV to Array

CSV to Array Converter

A real CSV parser, not a comma split.

Parse the CSV

CSV to Array Converter

0 items / 0 unique
Input Text
0 characters Ctrl+Enter to convert - Drag and drop .txt
Split Input By
CSV parsing

RFC 4180 keeps a comma inside a quoted field as part of the value.

Cleaning Options
Output
Output Format
JSON options
Customization
Output 0 unique Output
// Your converted output will appear here.
Paste text and click Convert Text, or use Ctrl+Enter.
Your text stays private. All conversion happens locally in your browser using JavaScript. Nothing is uploaded to any server.

Quoted fields containing commas stay whole, doubled quotes are unescaped, CRLF and LF both work, and a header row can become object keys.

How It Works

How to use the CSV to Array Converter

  1. Paste the CSV

    Rows separated by newlines. Copying straight out of a spreadsheet usually gives tab-separated data instead — switch the delimiter to Tab for that.

  2. Say whether the first row is a header

    With Header row on and the Objects shape selected, each row becomes an object keyed by the header names.

  3. Choose the output shape

    Flat for one array of every cell, Rows for an array per line, Objects for header-keyed records.

Examples

CSV to Array Converter examples

Header row to objects

Input

name,email,city
John,john@example.com,"New York, NY"

Output

[
  {
    "name": "John",
    "email": "john@example.com",
    "city": "New York, NY"
  }
]

The comma inside "New York, NY" is part of the value, not a separator.

Rows as nested arrays

Input

1,2,3
4,5,6

Output

[
  ["1","2","3"],
  ["4","5","6"]
]

Escaped quotes inside a field

Input

quote
"She said ""hello"" once"

Output

[
  "She said \"hello\" once"
]

A doubled quote inside a quoted field is one literal quote character.

Notes

Working with csv to array

Why splitting on commas is not parsing CSV

The line John,"New York, NY",NY has three fields, but splitting on commas gives four. Quoted fields exist precisely so a value can contain the delimiter, and honouring them is the difference between a parser and a split. This page implements RFC 4180: quoted fields, doubled quotes as an escape, embedded newlines inside quotes, and CRLF or LF endings.

Header rows and object output

With Objects selected the first row supplies the keys, so each record arrives as a name/email/city object rather than a positional array — the shape most APIs and ORMs want. If the header has duplicate names the later column wins, so rename the columns first if that matters.

Ragged rows are reported, not silently fixed

If some rows have more cells than others the tool says so rather than padding or truncating quietly. That mismatch almost always means an unescaped quote or a stray delimiter further up the file, and you want to know before the data reaches your database.

FAQ

CSV to Array Converter FAQs

CSV to Array Converter

A real CSV parser, not a comma split. Quoted fields containing commas stay whole, doubled quotes are unescaped, CRLF and LF both work, and a header row can become object keys.