Text to JSON array
Transformed in your browser · nothing is uploaded
Turns a list of lines into a JSON array of strings with every value properly escaped — quotes, backslashes and control characters included.
How to use the text to json array
Escaping is the whole reason to use a tool rather than wrapping each line in quotes by hand. A value containing a double quote or a backslash produces invalid JSON when quoted naively, and the failure appears wherever the JSON is eventually parsed rather than where it was built. Building it with `JSON.stringify` handles every case correctly, including the control characters that are invisible in the source. Blank lines are dropped and each value is trimmed, which is almost always wanted for a pasted list and is worth knowing if it is not.
Questions
A value containing a quote or a backslash produces invalid JSON. Proper escaping handles every case.