v2.1.5+ Testing JSONata expressions with the JSONata editor

Use the JSONata editor to evaluate and refine JSONata expressions against real or generated task context data before saving them to a workflow definition.

Before you begin

To load context from a previous run, the workflow must have at least one completed run in the plan history and you must be authorized to view the corresponding plan items.

Procedure

  1. In the Graphical Designer, open the workflow or task definition you want to work with.
  2. Locate a field that supports JSONata expressions, such as an output condition, output property, pre-condition, or task input field, and click its JSONata editor icon.
    The JSONata editor opens. Any expression already defined in the field is pre-loaded into the Expression pane.
  3. Populate the JSON Context pane with the context data to evaluate against:
    • To use the context from a previous run, open the JSON Context drop-down, which lists the default context and all available previous runs in chronological order, and select the run you want. The full JSON context for that run is loaded into the pane.
    • To test a specific scenario, type or paste a JSON directly into the JSON Context pane, or edit the context already loaded there.
  4. In the Expression pane, type or edit your JSONata expression.

    The editor supports both plain mode (a single JSONata expression) and embedded mode (a template string containing ${...} blocks with optional J:, Y:, or T: modifiers). For details, see JSONata editor.

  5. Review the Result and validation pane.

    The pane updates automatically after a short delay each time you modify the expression or context. It displays:

    • The evaluated result.
    • Any syntax or runtime errors from the expression.
    • A type-validation warning if the result type does not match the expected type for the target field (for example, if a pre-condition expression returns a non-boolean value).
  6. When the expression produces the expected result, close the editor and save the workflow definition.

Results

The validated expression is written back to the originating field. The editor does not auto-save; changes to the workflow definition take effect only when you explicitly save.

Generating an expression with AI assistance

The JSONata editor includes a Generate Expression button that uses the current context and expression as input to propose a JSONata expression from a natural-language prompt.

  1. Load context into the JSON Context pane as described above.
  2. Click Generate Expression to open the prompt field.
  3. Type a description of the logic you want the expression to implement, for example: Return true if the count from extractTask is greater than zero and the country is IT.
  4. Submit the prompt. If generation succeeds, the proposed expression replaces the current content of the Expression pane.
  5. Review and refine the generated expression as needed, then evaluate it in the Result and Validation pane before saving.
Note: Generation failures do not affect the existing expression or evaluation results. If generation fails, the Expression pane retains its previous content and evaluation continues to function normally.