JSON Builder step

  • Release version: Australia
  • Updated March 12, 2026
  • 3 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of JSON Builder step

    The JSON Builder step in ServiceNow’s Integration Hub enables you to create dynamic JSON payloads for use in subsequent workflow steps. It supports various data types, including nested objects and arrays, allowing you to construct complex JSON structures tailored to your integration needs.

    Show full answer Show less

    This step requires an Integration Hub subscription and is available after plugin activation under Integrations in Workflow Studio. Users with the actiondesigner role can include this step in custom actions.

    Key Features

    • Dynamic Inputs: Define name-value pairs where both names and values can be static or dynamic using data pills from the Data panel.
    • Data Types Supported: String, Object, Number, Boolean, and Array. Nested structures can be built using the plus icon to add name-value pairs within arrays or objects.
    • Empty Value Handling: Options to leave empty values as empty strings, omit properties, set them as null, or throw an error if a name-value pair is empty or null.
    • Structure Control: Choose whether to include outer curly braces for the JSON container and whether to omit the payload if it is empty.
    • Outputs: The step produces a JSON payload string output, which can be parsed later with the JSON parser step if needed. It also returns a Step Status object indicating success or error with code and message details.
    • JSON Payload Generator: An Add JSON for Payload button lets you input a JSON script to automatically generate structured inputs. This tool handles nested objects and arrays but has limitations (e.g., no empty payloads, no invalid JSON, max size 65,000 bytes).

    Practical Use and Considerations

    This step is essential when building integrations that require customized JSON payloads for API calls or internal processing. It provides flexibility to compose payloads dynamically based on workflow data and ensures proper data type matching for downstream consumption.

    Be aware that generating a JSON payload via the script editor will overwrite any existing structure in the step. Also, invalid JSON or empty payloads are not supported during generation, so careful validation is advised.

    The Step Status outputs allow you to implement error handling by detecting failures in JSON construction and responding appropriately in your workflows.

    Create a JSON payload to use in another step. Enter values or use data pills to produce a dynamic payload. This step supports several data types, including objects and arrays for nested structures.

    Roles and availability

    This step requires an Integration Hub subscription. For more information, see Legal schedules - Integration Hub overview. After the required plugin is activated, the step is visible under Integrations.

    Available as an Workflow Studio action step. Users with the action_designer role can create a custom action with one or more action steps.

    Inputs

    Provide a value for each input that your action needs. To add dynamic values, you can also drag and drop pills from the Data panel or select them from the pill picker.

    Name
    Data type: String

    Name part of a name-value pair. Enter a value or use a data pill to produce a dynamic payload.

    Value
    Data type: String

    Value part of a name-value pair. Enter a value or use a data pill to produce a dynamic payload. You can use a complex object pill to populate a row with an object data type, but doing so deletes any children the complex object pill already has.

    Type
    Data type: Choice
    Data type for the name-value pair. If you're using a data pill for the name or value, make sure the data type for the pill matches the data type selected here. The options are:
    • String
    • Object
    • Number
    • Boolean
    • Array

    For arrays and objects, use the plus icon (plus icon) to add name-value pairs to the array or object.

    In case of empty value
    Data type: Choice
    Option to specify what to do if a name-value pair has an empty or null value.
    • Leave as is: Keeps the empty or null value as an empty string.
    • Omit property: Excludes a name-value pair if the value is empty or null.
    • Set as null: Returns an empty or null value as a null data type.
    • Throw error: Returns an error if a name-value pair has an empty or null value.
    Include Outer Structure
    Data type: True/False

    Option to include the curly braces for a top-level JSON container.

    Omit Empty Structure
    Data type: True/False

    Option to omit an empty payload. Empty payloads can occur when you select Omit property for the In case of empty value input for every name-value pair and all name-value pairs in the payload produce empty values.

    Structure
    Data type: Structure

    Read-only payload the step produces.

    If this step fails
    Data type: Choice

    Option to continue running the next step or go to error evaluation. To use the step status code or message for a custom action error condition, see .

    Outputs

    These outputs appear in the Data panel. You can use them as inputs elsewhere in your action.

    Output
    Data type: String

    JSON payload as a string. If you want to use the payload as an object, you can use the JSON parser step to parse the string.

    Step Status
    Data type: Object

    Object data pill containing runtime details about the step. Each step in an action returns a Step Status.

    Step Status > Code
    Data type: Integer

    Integer data pill indicating whether the step produced an error. By default, a value of 1 indicates that the step produced an error. A value of 0 indicates that the step ran successfully. You can't customize these codes.

    Step Status > Message
    Data type: String

    String data pill containing the error message produced by the step or system operation. You can't customize this message.

    Generate a JSON Payload

    Automatically generate a JSON payload with the Add JSON for Payload button. This button opens the Add Payload script editor where you can enter a JSON payload to be automatically de-serialized into structured input.

    There are a few details to be aware of when using the JSON payload generator.
    • If the JSON has empty keys, the payload is still generated.
    • If there are duplicate keys in the script editor, the last key entry in the object overrides the value of any previous keys with the same name.
    • If the root object is an array, the root array is wrapped into a root object.
    • If an array contains multiple objects, all the keys in the objects are coalesced into one parent object.
    The JSON payload generator doesn’t support the following.
    • empty payloads
    • non-complex object types
    • invalid JSON
    • empty root objects, such as an empty array
    • payloads larger than 65,000 bytes
    Note:
    Generating a JSON payload overrides any existing structures in the JSON Builder step.