Skip to main content

To Text

Uncontrolled node

Overview​

The To Text node converts any input value into its string representation. This is useful when you need to serialize data for display, logging, or passing to text-based inputs like prompts or file writers.

The node handles all common data types:

  • Strings: Passed through unchanged
  • Numbers: Converted to numeric strings (e.g., 42 → "42")
  • Booleans: Converted to "true" or "false"
  • Null/Undefined: Converted to "null" or "undefined" respectively
  • Arrays & Objects: Serialized to JSON strings (e.g., [1,2,3] → "[1,2,3]")

Inputs​

InputTypeDescriptionDefault
ValueAnyThe value to convert to text. Accepts any data type including strings, numbers, booleans, null, undefined, arrays, or objects.—

Outputs​

OutputTypeDescription
TextTextThe string representation of the input value.

Runtime Behavior​

As an uncontrolled node, To Text runs automatically whenever its input value changes. It does not require an event trigger to execute.

The conversion logic follows these rules:

  • Primitive types (string, number, boolean) use standard JavaScript string coercion
  • null and undefined are converted to their literal string names
  • Arrays and objects are serialized using JSON.stringify(). If serialization fails (e.g., circular references), the node outputs "[]" for arrays or "{}" for objects

Example​

Converting a number to text for concatenation:

[Number Node: value = 42] 
↓
[To Text Node: value = 42]
↓
[Text Node: "The answer is " + text → "The answer is 42"]

Serializing an object for storage:

[Dictionary Node: {name: "Alice", age: 30}]
↓
[To Text Node: value = {name: "Alice", age: 30}]
↓
[Write To Library Node: data = '{"name":"Alice","age":30}']