The Transform node in Cobalt allows you to manipulate and transform complex JSON data into a more accessible format using JSONata expressions.

If you want to learn about JSONata expression, refer here.

Input Fields

The Transform node offers two input fields:

Please note that both the input and query fields are required for the Transform node to function properly.

Input

This field accepts a JSON object, where the Array needs to be given and can be selected from a DataSlot or a previous Node in the workflow. It serves as the input data for transformation. The format of the Input can be in the format:

{
  "input": "{Array_name}" // When you have the Array
  "input": "{{Node_name: data}}" // When you want to fetch response of a previous node.
  // The Node_name is selected by using Nodes in Variables

  // "input" and "data" key can be replaced by any other word like result etc.
}

Query

In this field, users need to provide a valid JSONata expression to query or transform the input object. The expression structure in Query is given below.

{
  "output": "JSONata expression" 
  // The key should be "output" in Query field.
}

If only the JSONata expression is provided in Query field rather than an object, then the node will give an empty response and result cannot be used in further nodes of the Workflow.

By leveraging the Transform node in Cobalt workflows, users can efficiently process and manipulate JSON data. Whether extracting specific information or performing complex transformations, the Transform node offers a powerful tool for managing JSON data within workflows.