Convert text and CSV columns to arrays

Paste a list or load a UTF-8 file to create arrays, JSON or MySQL INSERT statements. Your input stays in your browser.

See worked conversion examples
CSV supports quoted commas, escaped quotation marks and line breaks inside fields.
UTF-8 text files up to 10 MB. Loaded text uses the same parser as pasted text.
Your converted result appears here.

Conversion requires JavaScript.

Transformations (2 enabled)

Cleanup runs before encoding, duplicate handling and sorting. Output escaping is applied last.

Cleanup
Encoding
Duplicates and ordering
Counts use count:value. Counting groups duplicates and preserves their original frequency.
Saved presets

Formats and transformations are remembered on this browser. Named presets can also save a particular setup.

Input is saved on this device only when this box is checked. Saved data remains until you delete or overwrite its preset.

Worked conversion examples

Convert a newline list to a JavaScript array

Set the input to One item per row and the output to JavaScript array. Each line becomes a string in the array.

Input
red
blue
JavaScript output
["red", "blue"];

Convert a CSV column to a JSON array

Choose Comma separated (CSV), check First row contains column names, and select Column 1 (id) and JSON array. ArrayCat extracts the selected column as a flat array of values. Leading zeros survive even with type detection enabled.

CSV input
id,product
001,"Pencil, blue"
042,Notebook
JSON output
["001", "042"]

Convert a list to MySQL INSERT statements

Choose One item per row and SQL INSERT (MySQL). Set the table name to products and the column name to name. ArrayCat encodes each value as UTF-8 hex so punctuation is preserved.

Input
Pen
MySQL output
INSERT IGNORE INTO `products` (`name`) VALUES (CONVERT(X'50656e' USING utf8mb4));

Formats and conversion options

ArrayCat is a free converter for JavaScript, PHP, Go, Delphi and Pascal arrays, Python lists, JSON arrays, MySQL INSERT statements and plain lists. Copy or download the result after converting.

Clean up your data

Remove duplicates and empty items, count repeated values, sort lists, remove diacritics, change letter case, fix quotation marks, normalize whitespace, encode HTML entities or convert values to UTF-8 Base64. Expand Transformations to choose which operations to apply.

Choose how values are represented

JSON keeps values as strings by default. Type detection can turn values such as 42, true and null into JSON numbers, booleans and null. Values with leading zeros, unsafe integers and numbers that would lose precision stay as strings. The row length setting wraps arrays between values and keeps individual values intact. Pascal and Delphi output uses UTF-8 source and fixed UnicodeString arrays, which require at least one value.