JSON Conditions

Conditions can be used for conditional flows to determine the following task.

A condition is a boolean expression with a JavaScript-like syntax. It allows to compare properties of the workflow instance payload with other properties or literals (e.g., numbers, strings, etc.). The payload properties are selected using JSON Path.

$.totalPrice > 100

$.owner == "Paul"

$.orderCount >= 5 && $.orderCount < 15

Literals

Literal Examples
JSON Path $.totalPrice, $.order.id, $.items[0].name
Number 25, 4.5, -3, -5.5
String "Paul", 'Jonny'
Boolean true, false
Null-Value null

A Null-Value can be used to check if a property is set (e.g., $.owner == null). If the property doesn't exist, then the JSON Path evaluation fails.

Comparison Operators

Operator Description Example
== equal to $.owner == "Paul"
!= not equal to $.owner != "Paul"
< less than $.totalPrice < 25
<= less than or equal to $.totalPrice <= 25
> greater than $.totalPrice > 25
>= greater than or equal to $.totalPrice >= 25

The operators <, <=, > and >= can only be used for numbers.

If the values of an operator have different types, then the evaluation fails.

Logical Operators

Operator Description Example
&& and $.orderCount >= 5 && $.orderCount < 15
|| or $.orderCount > 15 || $.totalPrice > 50

It's also possible to use parentheses between the operators to change the precedence (e.g., ($.owner == "Paul" || $.owner == "Jonny") && $.totalPrice > 25).