Lines to JSON Array / SQL IN List.
Turn a column of values into a JSON array, SQL IN clause, CSV row, PHP or Python list.
Runs in your browserAbout Lines to JSON Array / SQL IN List
Paste a column copied from a spreadsheet, a log or a query result and get it back as a ready-to-use list literal. The JSON format produces a valid array with proper string escaping, so quotes, backslashes and Unicode survive. The SQL format builds an IN clause with single quotes and doubles any quote inside a value, which means a name like O'Brien becomes 'O''Brien' instead of breaking the query or opening the door to injection when you paste it into a console. CSV output quotes only the values that need it, following RFC 4180, and the PHP and Python formats use single-quoted strings with the escapes each language expects. When every value is a number, auto mode leaves them unquoted, so a list of user IDs becomes IN (12, 15, 99) rather than a list of strings; force string mode for things like ZIP codes or phone numbers where leading zeros matter, or number mode to be warned about a stray non-numeric line. Values are trimmed and empty lines skipped by default, and you can remove duplicates or print one value per line for long lists. A typical mistake is building an IN list from thousands of values; most databases accept it, but a temporary table or a join is usually faster. Conversion happens entirely in your browser.
How to Use
- Paste one value per line.
- Pick the output format and how values should be typed.
- Copy the list into your code or query.
Frequently Asked Questions
How are quotes inside values handled?
Each format uses its own escaping: JSON escapes with a backslash, SQL doubles single quotes, CSV doubles double quotes, PHP and Python escape quotes and backslashes.
Why are my numbers quoted?
In auto mode numbers stay unquoted only when every value is a number. Values with leading zeros such as 007 count as text on purpose.
What does an empty input produce?
An empty result. An empty IN () list is invalid SQL, so the tool does not generate one.
Is my data uploaded?
No. The conversion runs locally in your browser.
Related Tools
Add a prefix or suffix to every line, join lines with a separator, or split text into lines.
Sort lines alphabetically or naturally and remove duplicates.
Convert between CSV and JSON formats.
Pretty print, minify, and validate JSON.
Format and beautify SQL queries.
Convert text between case formats.