JQ Expression Syntax for Creating Filters
This section describes common JQ syntax elements you can use to create filter conditions.
JQ Filter | Description | JSON Sample | Result |
---|---|---|---|
|
Selects all elements of an array. |
|
|
|
Selects a specific field from each object in an array. |
|
|
|
Filters elements where a specific field equals a value. |
|
|
|
Extracts the results of a specific function applied. |
|
|
|
Filters elements of an array where a specific field equals a value. |
|
|
|
Filters elements with a length greater than
5 .
|
|
|
|
Selects elements where both conditions are true. |
|
|
|
Selects elements where at least one of the conditions is true. |
|
|
|
Selects elements where both conditions are true. |
|
|
|
Combines and and or conditions
to filter elements where the first condition is true and either the
second condition is true or the third condition is
include .
|
|
|
|
Selects elements where the field1 is not equal
to value .
|
|
|
|
Combines and conditions to filter elements where
the first condition is true and both the second and third conditions
are true.
|
|
|
|
Combines or conditions to filter elements where
either the first condition is true or both the second and third
conditions are true.
|
|
|
|
Combines multiple and conditions to filter
elements where all conditions are true.
|
|
|
|
Combines not and or conditions
to filter elements where field1 is not equal to
value and either field2 is
less than or equal to 10 or field3
is exclude .
|
|
|
|
Returns exactly true while executing rather than returning the values. |
|
|