toString (object)

Task purpose

The toString (object) task converts a valid JSON value to a JSON string, optionally replacing values if a replacer function is specified, or including only specified properties if a replacer array is specified.

Potential use case

If a query into a ticketing database returns data as a JSON object, you could use this task to convert the object to a string and include it as the body of an email.

Properties

IncomingTypeDescription
value*Required. Any valid JSON value to convert to a string. The wildcard (*) represents any JSON value — for example, an object, array, or number.
replacerArrayOptional. An array of String and Number objects that act as a whitelist, selecting which properties of the value object to include in the JSON string.
spaceNumberOptional. A number that inserts white space into the output JSON string for readability.
OutgoingTypeDescription
stringifiedStringA string representation of the object.

Example

The input variable value is shown in Task History, accessible from Jobs in Operations Manager.

toString (object) task — incoming variable

The output shows the stringified object. No white space is added since no space value was set.

toString (object) task — output