Skip to main content

To String

Converts any value to its string representation.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Source - Any value to convert to string (number, boolean, object, array, etc.).

Options

This node does not have configurable options.

Output

  • String - String representation of the input value.

How It Works

The To String node converts any data type to its string representation using Go's formatting:

  • Numbers: Converted to decimal string representation
  • Booleans: Converted to "true" or "false"
  • Objects: Formatted with field names and values
  • Arrays: Formatted as list with brackets
  • Null/undefined: Converted to string representation

The node uses Go's fmt.Sprintf("%+v") format, which includes field names for structs.

Usage Examples

Example 1: Convert Number to String

  • Source: 42
  • Result: "42"

Example 2: Convert Boolean to String

  • Source: true
  • Result: "true"

Example 3: Convert Object to String

  • Source: {name: "John", age: 30}
  • Result: "{name:John age:30}"

Example 4: Convert Array to String

  • Source: [1, 2, 3]
  • Result: "[1 2 3]"

Example 5: Convert Float to String

  • Source: 3.14159
  • Result: "3.14159"

Tips

  • Use before concatenating non-string values
  • Useful for logging and debugging - convert any value to see its contents
  • Object and array conversion is for display/logging, not for JSON serialization
  • For JSON output, use a dedicated JSON serialization node
  • Automatically handles all data types without errors
  • Great for creating descriptive error messages or logs

Common Use Cases

Logging and Debugging

Convert any variable to string for logging:

Source: ${msg.userData}
Result: "{id:123 name:John email:john@example.com}"
Use: Write to log file

Number to String for Display

Convert calculated values to strings:

Source: ${msg.totalPrice}  // 99.99
Result: "99.99"
Use: Display in UI or concatenate with text

Boolean to String

Convert boolean flags to readable text:

Source: ${msg.isActive}  // true
Result: "true"
Use: Include in status messages

Array to String

Convert array for display:

Source: ${msg.tags}  // ["urgent", "customer", "billing"]
Result: "[urgent customer billing]"
Use: Simple display (not comma-separated)

Practical RPA Examples

Example: Create Log Message

Step 1: ToString on user object
Result: "{id:123 email:user@example.com}"
Step 2: Concatenate with timestamp
Final: "2024-01-15: {id:123 email:user@example.com}"

Example: Build Status Message

Source: ${msg.recordCount}  // 150
ToString Result: "150"
Concatenate: "Processed " + "150" + " records"
Final: "Processed 150 records"

Example: Debug Complex Objects

Source: ${msg.apiResponse}
Result: String representation of entire response
Use: Write to debug log to inspect structure

Example: Create File Names

Source: ${msg.invoiceNumber}  // 12345
ToString Result: "12345"
Concatenate: "invoice_" + "12345" + ".pdf"
Final: "invoice_12345.pdf"

Example: Error Message Formatting

Source: ${msg.errorCode}  // 404
ToString Result: "404"
Concatenate: "Error " + "404" + ": Not Found"
Final: "Error 404: Not Found"

Notes

  • This is a universal converter - works with any input type
  • For complex objects, output format is designed for readability, not parsing
  • Use JSON nodes if you need valid JSON string output
  • The conversion never fails - all types can be converted to string
  • Nested objects and arrays are recursively formatted