Text to JSON array
Transformed in your browser · nothing is uploaded
Turns a list of lines into a JSON array of strings, escaped properly rather than by hand; quotes, backslashes, tabs and control characters all come out valid. Blank lines are dropped, every value is trimmed, and the array is printed one value per line, indented two spaces.
How to use the text to json array
Escaping is the whole reason to use a tool instead of adding quotes by hand. A line reading say "hello" comes out as "say \"hello\"", and back\slash as "back\\slash". Wrap those in quotes yourself and you get "say "hello"", which is not valid JSON, and the failure surfaces wherever the file is eventually parsed, a long way from where it was built. A tab inside a value becomes \t for the same reason. A paste from Windows brings a carriage return on every line; those are removed along with the line breaks rather than escaped into the values.
Two limits worth knowing. Everything comes out as a string, because a flat list carries no type information: 42 becomes "42" and true becomes "true". If you need real numbers, booleans or objects, start from a header row in the CSV to JSON converter instead. And accented characters and emoji are written as themselves rather than as \u escapes; café stays café. That is valid JSON, which is Unicode text, and every conformant parser reads it; only a system that insists on plain ASCII will complain.
Questions
A value containing a double quote or a backslash makes the JSON invalid, and it fails at whatever parses it later rather than here.
No, everything is a string. 42 comes out as "42". A flat list of lines has no type information to work from.
No. They are dropped and every value is trimmed, which is what a pasted column almost always needs.
Not from a flat list. Paste a header row and rows into the CSV to JSON converter for that.
They are written as themselves, not as \u escapes. That is valid JSON — the format is Unicode text.
Not here; the output is indented two spaces. Run it through the JSON minifier if you need it flat.
No. Carriage returns go with the line breaks instead of ending up as \r inside the values.