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


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 any property in specified JSON Path doesn't exist, then it would be resolved as null and could be compared as such.

Payload JSON Path Value
{"foo": 3} $.foo 3
{"foo": 3} $.bar null
{"foo": 3} $.bar.baz null

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. Comparing null or missing property with a number is considered as comparing different types.

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).