Skip to main content
The JSONata command (Command Type: 1022) evaluates a JSONata expression against the current input data. JSONata is a lightweight query and transformation language for JSON.

Overview

The JSONata command provides functionality for:
  • Evaluating complex transformation expressions against JSON data
  • Outputting results to the data field or children array
  • Setting an evaluation timeout to prevent runaway expressions

Command Type

Command Type ID: 1022

Parameters

ParameterTypeDescriptionRequired
expressionstringInline JSONata expression stringYes
timeoutnumberTimeout for evaluation in millisecondsYes
keystringWhere to store the evaluation result. "data" (default) stores in data field; "children" stores in children array (result must be an array). Possible values: "data", "children"No

Usage Examples

Sum a Field Across an Array

{
  "command": "jsonata",
  "params": {
    "expression": "$sum(items.price)",
    "timeout": 5000
  }
}

Transform and Restructure Data

{
  "command": "jsonata",
  "params": {
    "expression": "items.{ 'id': id, 'label': name & ' (' & status & ')' }",
    "timeout": 5000,
    "key": "children"
  }
}

Filter with Expression

{
  "command": "jsonata",
  "params": {
    "expression": "items[status = 'active']",
    "timeout": 3000,
    "key": "children"
  }
}

String Concatenation

{
  "command": "jsonata",
  "params": {
    "expression": "firstName & ' ' & lastName",
    "timeout": 2000
  }
}

Output Key Options

ValueBehaviour
"data"Stores the expression result in the data field (default)
"children"Stores the expression result in the children array — result must be an array

Common Use Cases

  • Aggregations: Sum, average, or count values across arrays
  • Complex Transformations: Reshape data structures in a single expressive step
  • Conditional Logic: Apply conditional transformations without multiple commands
  • String Formatting: Concatenate or format string fields