# 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** |
| -------------------------------- | ------------------------------------------------------------------------------ | ------------ |
| Node name                        | [Node name](https://docs.cosmocloud.io/flow-builder/node-name)                 | true         |
| 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

1. Specify the name of the variable where the resulting string will be stored.
2. 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:

1. Set Output Variable Name to `user_data_string`
2. 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.
