How can one convert an expression to a string while keeping the quotation marks of strings that are part of the expression?

ToString[{"a", "b"}, InputForm]
(*    "{\"a\", \"b\"}"    *)

(thanks @kglr for golfing!)

If you need to get rid of the space between the strings in the string (as per your specification), then use a StringDelete[" "] operator:

ToString[{"a", "b"}, InputForm] // StringDelete[" "]
(*    "{\"a\",\"b\"}"    *)

ToString[{"a", "b"} /. x_String :> ("\"" <> x <> "\"")] seems to work.


StringTemplate["{\"``\",\"``\"}"] @@ {"a", "b"}

"{\"a\",\"b\"}"