JavaScript Array Converter
Generate a ready-to-paste JavaScript array from pasted values.
Build the JavaScript array
JavaScript Array Converter
// Your converted output will appear here.
Choose the declaration keyword, the quote style, and whether numbers and booleans stay quoted strings or become real JavaScript literals.
How to use the JavaScript Array Converter
Paste your values
One per line by default. Switch the delimiter if your source is comma or tab separated.
Set the declaration and quotes
const, let, var, or none for a bare literal. Double quotes, single quotes, or backticks — backticks additionally escape ${ so template interpolation cannot fire.
Decide how values are typed
Leave Value type on Strings to quote everything. Switch to Auto when the list really is numbers, booleans or nulls that should be JavaScript literals.
JavaScript Array Converter examples
A const array of strings
Input
React Node.js TypeScript
Output
const technologies = [ "React", "Node.js", "TypeScript" ];
Mixed literals with type detection on
Input
42 true null hello
Output
const values = [ 42, true, null, "hello" ];
With Value type set to Auto, bare numbers, true/false and null become JavaScript literals rather than strings.
Apostrophes with single quotes selected
Input
O'Brien D'Angelo
Output
const names = [ 'O\'Brien', 'D\'Angelo' ];
Working with text to array javascript
const, let, or a bare literal
const suits a lookup table you never reassign — note that it prevents reassignment of the binding, not mutation of the array, so push() still works. Use let only if you reassign the variable itself. Turn the declaration off when you are pasting into an existing object, a function argument, or a config literal.
Which quote character to pick
Double quotes match JSON and most style guides. Single quotes suit codebases whose linter prefers them. Backticks are worth choosing only when a value already contains both quote types — this tool escapes the backtick and ${ inside them, so a value like ${user} stays literal instead of becoming an interpolation.
Escaping that actually matters
Backslashes, newlines, tabs and the enclosing quote are escaped. So are U+2028 and U+2029, two line separators that are legal inside a JavaScript string but break older parsers and any JSONP-style embedding. You rarely type them; they arrive constantly in text copied from PDFs and word processors.
Popular text conversion tools
Text to JSON Array Converter
Use this free online text to JSON array converter to turn lines, lists, TXT files, or delimited values into valid pretty-printed or minified JSON.
String to Array Converter
Use this free online string to array converter to split text by commas, delimiters, whitespace, regex, or visible characters and copy matching code.
Python List Converter
Convert pasted text into a Python list, tuple or set with correct True, False and None literals, single or double quotes, and numeric type detection.
PHP Array Converter
Convert text into a PHP array using short [] or classic array() syntax, with the correct single and double quote escaping and true, false and null literals.
JavaScript Array Converter FAQs
JavaScript Array Converter
Generate a ready-to-paste JavaScript array from pasted values. Choose the declaration keyword, the quote style, and whether numbers and booleans stay quoted strings or become real JavaScript literals.