Object to String
Object To String node is designed to convert a complex object into its string representation. This node is particularly useful when you need to serialise an object, typically for storage or transmission purposes.
Properties Panel
Field
Description
Required
Name of variable to store output
The name of the variable to store the resulting string.
true
Input Object
The object or variable name containing the object to be converted to a string.
true
Usage
Specify the name of the variable where the resulting string will be stored.
Provide the object or variable name containing the object you want to convert to a string.
Behaviour
The node takes the input object and converts it to a JSON string representation.
The resulting string is stored in the specified output variable.
If the input cannot be converted to a JSON string, the node will raise an error.
Returns
The node sets a new variable with the name specified in the variable name field. This variable will contain the string representation of the input object. You can access this variable using Magical Autocomplete (e.g., $.variables.<variable_name>
) in any node below this node.
Example
Let's say you have a complex object stored in a variable called user_data
and you want to convert it to a string:
Set Output Variable Name to
user_data_string
Set Input Object to
$.variables.user_data
This will create a new variable user_data_string
containing the JSON string representation of the user_data
object which can be later accessed by using $.variables.user_data_string
.
Best Practices
Use this node when you need to serialise complex objects for storage or transmission.
Be cautious when converting large objects, as the resulting string can be quite long.
Last updated