select

utility

Filters truthy values (keeps non-null, non-false)

Syntax

select(value)

Parameters

value (any)

The condition or value to evaluate

Returns

any

The input value if truthy, otherwise filters it out

Examples

Keep only active users
Input:
map(select(.active))
Output:
[{name: "Alice", active: true}]
Keep high scorers
Input:
map(select(.score > 80))
Output:
[{name: "Bob", score: 95}]

The select() function filters values based on truthiness, keeping only non-null and non-false values.

Usage

Use select() within map() to filter arrays, or to remove empty/null values from data pipelines.

Related Functions