The to-string operation turns a value into text.
Use it when the other side expects a string and you are holding a number or a boolean. Some APIs are strict about it and reject 42 where they wanted "42", especially when the value is an identifier rather than a quantity.
It changes the type, not just the look of the value. The field becomes a string, so a JSON request carries "42" with quotation marks rather than 42.
What comes out
- An integer becomes its digits.
42becomes"42". - A float becomes its decimal notation.
1.25becomes"1.25". A float with nothing after the decimal point loses it, so42.0becomes"42", not"42.0". - A string is unchanged.
- true becomes
"1". - false becomes an empty string, not
"false"and not"0". - Null becomes an empty string.
- A list becomes the literal text
"Array", which is never what you want. - An object can only be converted if it knows how to represent itself as text. Otherwise it causes an error.
The catch
The boolean is the one that catches people out. true becomes "1" and false becomes nothing at all, so a consent checkbox that was not ticked arrives as an empty field rather than as a “no”.
If the advertiser expects the words "true" and "false", or "yes" and "no", do not use to-string. Use set value with a condition for each value, which gives you exactly the two strings they asked for.
The same applies to null. An empty value stays empty, so if the field is required on their side you need set value to put something in it, or do-not-send to leave it out altogether.
When you actually need it
Most values in a scenario are already strings, because that is how form fields arrive. You need to-string mainly after another operation changed the type, for example when to-int or math produced a number and the advertiser wants it quoted.
Identifiers are the common case. A number that is really a code, such as a bank code or a product ID, should be a string, otherwise a leading zero disappears and 0100 becomes 100.
Settings
The operation takes no parameter. Set the source and the condition, choose to-string, and there is nothing else to fill in.
Reference
The conversion follows PHP’s rules for casting to string. See PHP: Converting to string.

