jq Filters and Transformations/Test membership with IN

Check whether a value appears in a stream.

Section: Boolean Logic

Test membership with IN

bash
bash
echo '"b"' | jq 'IN("a", "b", "c")'
Explanation

Useful for simple membership tests in jq expressions.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Boolean Logic
Logical AND
Filter items that satisfy two conditions.
OpenIn sheetbashsame section
Logical OR
Match either of two conditions.
OpenIn sheetbashsame section
Logical NOT
Invert a predicate.
OpenIn sheetbashsame section
Test regex match
Return true if a string matches a pattern.
OpenIn sheetbash1 tag match
Floor number
Round down to nearest integer.
OpenIn sheetbash1 tag match
Current Unix time
Get the current time as Unix epoch seconds.
OpenIn sheetbash1 tag match