coalesce
Returns the first non-null argument. Accepts any number of arguments.
value1, value2, ...(variadic): values to check in order
bash
echo '{"nickname": null, "displayName": null, "fullName": "Alice Johnson"}' \
| utlx -e 'coalesce($input.nickname, $input.displayName, $input.fullName, "Anonymous")'
# "Alice Johnson"utlx
{
name: coalesce($input.nickname, $input.displayName, $input.fullName, "Anonymous")
}Note: for two values, the ?? operator is cleaner: $input.name ?? "Unknown" (see Chapter 9).