JavaScript Array to JSON Converter

Paste a JavaScript array literal and get JSON you can copy or save. ArrayCat reads the literal as data.

Paste the array with its square brackets. Single quotes and trailing commas are fine.
UTF-8 text files up to 10 MB. For spreadsheets, save a copy as CSV or TSV first.

Conversion requires JavaScript.

Transformations (2 enabled)

ArrayCat cleans up and encodes values before grouping duplicates or sorting. It escapes the values for the output format last.

Cleanup
Encoding
Duplicates and ordering
Counting two copies of apple gives 2:apple.
Saved presets

Presets keep your formats and cleanup settings in this browser.

Delete or overwrite the preset to remove any text saved with it.

Worked example

JavaScript array literal
['001', 2, true,]
JSON array
["001", 2, true]

Use quoted strings, decimal numbers, booleans, null and nested arrays or objects. Fill an empty slot with null and give each property a unique key. If an item is an expression, replace it with its value. Put long IDs in quotes to keep every digit.

If your array is already in a JavaScript variable, call JSON.stringify(values). Add two-space indentation with JSON.stringify(values, null, 2). See the ECMAScript reference.