empty

utility

Checks if a value is empty (null, empty array/string/object)

Syntax

empty(value)

Parameters

value (any)

The value to check

Returns

boolean

True if the value is empty, false otherwise

Examples

Check if array is empty
Input:
[] | empty
Output:
true
Check if string is empty
Input:
"" | empty
Output:
true
Filter non-empty descriptions
Input:
map(select(.description | empty | not))
Output:
[{description: "Valid text"}]

The empty() function checks whether a value is empty, including null values, empty arrays, empty strings, and empty objects.

Usage

Use empty() to filter out empty values, validate data completeness, or handle missing data in pipelines.