> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# objectToString

> Use the objectToString task to convert a valid JSON value to a JSON string.

The `objectToString` task converts a valid JSON value to a JSON string, optionally replacing values with a replacer function, or optionally including only specified properties if a replacer array is provided.

## Potential use case

Given a JSON object as input, this task returns a string containing all JSON object properties separated by commas. If a recent query into a ticketing database returns a body of data as a JSON object, use this task to convert the object and send its data as the body of an email.

## Properties

| Input      | Type   | Description                                                                                                                                       |
| :--------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------ |
| `value`    | \*     | Required. Any valid JSON value to convert to a string. Wildcard values (`*`) represent any JSON value — for example, an object, array, or number. |
| `replacer` | Array  | An array of String and Number objects that serve as a whitelist for selecting the properties of the value object to include in the JSON string.   |
| `space`    | Number | A number used to insert whitespace into the output JSON string for readability purposes.                                                          |

| Output        | Type   | Description                            |
| :------------ | :----- | :------------------------------------- |
| `stringified` | String | A string representation of the object. |

## Example

The input variable `value` is shown in **Task History**, accessed from Jobs in Operations Manager.

![](/_fern-img/5cb4f4dd5aa96dc12a46468c7f26627bacd781ee4aec1797d25088299eaa67f6.webp)

The return variable shows each element in the array separated by a comma. In this example no whitespace is applied, since the `space` variable was not set.

![](/_fern-img/aea33a13f278a3275d364de304b8fd18545b875e70b94d457dcabe0b24068ad2.webp)