JSLT block

The jslt_transform block applies a JSLT transformation to JSON data as a transformation block in a Connect+ dataflow. JSLT is an open-source query and transformation language for JSON. The block accepts a JSLT expression that defines how the input JSON is restructured or mapped before being passed to downstream blocks. The block name must be alphanumeric.

When to use this block

Use this block when your dataflow needs to restructure, filter, or remap a JSON payload before it is passed to the destination, for example, renaming fields, extracting nested values, or reshaping the payload structure.

Prerequisites

Before configuring this block, make sure you have a JSLT transformation expression prepared for your use case

Standard properties

Field nameRequiredDescription
Block nameNoA name for the block instance. The name must be alphanumeric. There is no character limit.
JSLT TransformationYesThe JSLT expression used to transform the input JSON data. Enter the transformation template in the code editor.
Send each record separatelyNoDetermines whether each record is sent as a separate API request. Select true to send one API request per record — your JSLT expression processes one row at a time. Select false to send all records in a single bulk API request — your JSLT expression must include a for loop to handle multiple rows. Default value: true.

Advanced properties

⚠️ Advanced properties for JSLT JSON Transform. Make changes only if you know what you are doing.

Field nameRequiredDescription
Query parametersNoKey-value pairs that add query parameters to the API request URL. Set the key to the query parameter name and the value to the JSON field name in the JSLT output to read the value from. The block appends the query parameters to the URL automatically in the http_write block; you don't need to include them in the API Endpoint field of the
AttributesNoKey-value pairs that declare variables for use in downstream blocks. Set the key to the attribute name and the value to the JSON field name in the JSLT output to read the value from, or enter a constant. Use attributes when a field is needed in a downstream block — such as the http_write block for path parameters or additional headers — but would be dropped during JSLT transformation. Attributes must be declared in this block before they can be referenced downstream. Use $attributeName to reference an attribute in the API Endpoint or Additional Headers fields of the http_write block. By default, each attribute is also passed as an additional header in the API request.

For details on writing the JSLT expression for different use cases, refer to the Use cases.

Choose the right expression structure

The structure of the JSLT expression depends on what the target API endpoint expects in the request body.

When the API expects a single object

Write a direct mapping. The expression maps one flat JSON input to the required nested structure and produces a single output object. Use this for endpoints like /v2/customers, which accept one record per request.

{
  "profiles": [
    {
      "firstName": .firstname,
      "lastName": .lastname,
      "source": .source,
      "identifiers": [
        {
          "type": .identifierType,
          "value": .value
        }
      ]
    }
  ]
}

When the API expects an array of objects

Use for (.) at the beginning of the expression. The loop iterates over every row in the input batch and produces one output object per row, wrapping all results into an array. Use this for endpoints like /v2/customers/bulk, which accept multiple records in a single request.

[
  for (.)
  {
    "profiles": [
      {
        "firstName": .firstname,
        "lastName": .lastname,
        "source": .source,
        "identifiers": [
          {
            "type": .identifierType,
            "value": .value
          }
        ]
      }
    ]
  }
]
📘

Note

When for (.) is used, the output is an array. In the http_write block, set Request split path to $.* to split the array into individual API calls.