Skip to main content

jmespath

Executes a JMESPath query on JSON payloads, expecting a boolean result. If the result of the query is true then the condition passes, otherwise it does not.

# Common config fields, showing default values
jmespath:
query: ""

Please refer to the JMESPath website for information and tutorials regarding the syntax of expressions.

Fields​

query​

A JMESPath query.

Type: string
Default: ""

# Examples
query: foo == 'bar'
query: length(doc.urls) > `0`

part​

The index of a message within a batch to test the condition against. This field is only applicable when batching messages at the input level.

Indexes can be negative, and if so the part will be selected from the end counting backwards starting from -1.

Type: number
Default: 0

Examples​

With the following config:

jmespath:
query: a == 'foo'

If the initial jmespaths of part 0 were:

{
"a": "foo"
}

Then the condition would pass.

JMESPath is traditionally used for mutating JSON, in order to do this please instead use the jmespath processor.