How to Convert a List to a JSON Array Online
You have a list of names, IDs, or tags and need them as a JSON array for an API payload, a config file, or a test fixture. Typing quotes and commas around dozens of values by hand is slow and one missing comma breaks the whole thing. Paste the list here and it converts instantly.
Convert your list now. Free, no account needed.
Open List Format Converter →How to do it
- Paste your list into the converter. One value per line.
- Select JSON Array from the format dropdown.
- Turn on Number Detect if your list is numeric. IDs and quantities come out as JSON numbers instead of quoted strings.
- Choose Pretty Print or compact, then copy.
A list like this:
apple banana cherry
becomes, with Pretty Print on:
[ "apple", "banana", "cherry" ]
or, with Pretty Print off:
["apple","banana","cherry"]
Numbers vs. strings
By default every line is treated as a string, so a list of IDs comes out as ["101", "102", "103"]. That's valid JSON, but if the field expects actual numbers - a database ID, a price, a
quantity - a quoted string can fail validation or cause a type mismatch when the array is parsed
back.
Turn on Number Detect and any line that's purely numeric (integers, decimals, or values in
scientific notation) is output unquoted: [101, 102, 103]. Lines that
aren't numeric - a name, an email, a code with letters in it - are left as quoted strings either
way, so it's safe to leave on even for mixed data.
Compact vs. pretty-printed
- Pretty-printed (Pretty Print on) - one item per line with two-space indentation. Easier to read, easier to diff in version control, and the format most people expect when pasting into a code file.
- Compact (Pretty Print off) - the whole array on one line. Useful for pasting into a URL query parameter, an environment variable, or a single-line config value where whitespace and line breaks aren't welcome.
Both are valid JSON and parse identically - the difference is purely formatting.
Special characters are escaped automatically
If a line in your list already contains a double quote, a backslash, or a line break inside a quoted field, the converter escapes it correctly so the result stays valid JSON. You don't need to manually add backslashes or worry about breaking the array - paste your data as-is.
Going the other way: JSON array back to a plain list
Paste a JSON array into the input box and the tool detects it automatically, whatever format the dropdown is currently set to. Each array element becomes one line, with quotes stripped, ready to use as a plain list, feed into another tool, or edit further.
Need other formats from the same list?
SQL IN clause, Markdown bullets, HTML list, CSV row: 21 formats, same tool.
Frequently Asked Questions
How do I convert a list to a JSON array?
How do I get numbers instead of quoted strings in the array?
42 or 3.14) is output without quotes as a JSON number. Lines that aren't numeric stay as quoted strings.Can I get compact JSON instead of pretty-printed?
["apple","banana","cherry"] instead of one item per line with indentation. Compact is useful for pasting into a URL or a config value; pretty-printed is easier to read and diff.