toString (object)
  • 15 Sep 2023
  • Dark
    Light
  • PDF

toString (object)

  • Dark
    Light
  • PDF

Article summary

Purpose

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

Potential Use Case

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

Parameters

Input and output parameters are shown below.

Input Type Description
value * Required. Any valid JSON value to be converted 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/filtering the properties of the value object to be included in the JSON string.
space Number A number that’s used to insert white space into the output JSON string for readability purposes.

Output Type Description
stringified String A string representation of the object.

Examples

In the IAP examples shown below:

  • The input variable ("value") is shown in the Task History, which is accessed from Jobs in Operations Manager.


    00-IAP23.1-toString-object-input


  • The return variable shows each element in the array separated by a comma. In this example, no white space is used since we did not set a spacer variable.


    01-IAP23.1-toString-object-output


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.