> For the complete documentation index, see [llms.txt](https://docs.cosmocloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cosmocloud.io/flow-builder/node-types/variable-nodes/json/object-to-string.md).

# 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](/flow-builder/node-name.md)                                        | 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cosmocloud.io/flow-builder/node-types/variable-nodes/json/object-to-string.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
