Skip to content

List Formatter

Turns lines into a comma list, quoted SQL IN clause, JSON array or bullet list, and back again.

Turns a column of values into a SQL IN clause, a JSON array, a quoted list or a bullet list — and takes any of those apart back into lines. The apostrophe handling is the part that matters: O’Brien becomes ’O’’Brien’, which is the SQL standard’s own escape.

🔒 Runs entirely in your browserlistformatjoinsql

Input

Direction

Format

An apostrophe inside a value is doubled — O'Brien becomes 'O''Brien' — which is the SQL standard's own escape. Backslash-escaping works only in MySQL and is how a generated IN clause usually breaks.

Result

values

4

characters out

49

How to use it

  1. Pick the direction

    Lines to a list, or a list back to lines. The second reads a JSON array, a SQL IN clause, a quoted list or a delimited one, and says which it detected.

  2. Choose the output shape

    The list shows each format by example — a,b or "a", "b" — so you pick by looking rather than by name. Custom lets you set the prefix, suffix and separator yourself.

  3. Check the count

    The value count is the sanity check. If it is one short of what you expected, a blank line was dropped or a quoted value swallowed a comma.

Common questions

Why is the apostrophe doubled?

Because that is how SQL escapes it — ’O’’Brien’ is the standard, and it works in every database. Backslash-escaping works only in MySQL, and using it is the usual way a generated IN clause breaks somewhere else.

A value with a comma in it split into two

Only if it was unquoted. Reading a list back, quoted values keep their commas: a, "b, c" is two values, not three. Quote the value in the source and it survives.

Is there a limit on the number of values?

Not here, but there is where you are pasting it. Oracle caps an IN list at 1,000 entries and other databases have their own limits; past a few hundred a temporary table or a join is the better shape anyway.

Feed it from

Next

These accept what this tool produces, so the result can go straight in.