Source: cirosantilli/jq-ignore-missing-attribute
= jq ignore missing attribute
{c}
``
echo '[{"a": 1, "b": 2}, {"b": 3}]' | jq '.[] | select(.a) | .a'
``
Output:
``
1
``
and no empty lines as desired.
Bibliography:
* https://stackoverflow.com/questions/42097410/how-to-check-for-presence-of-key-in-jq-before-iterating-over-the-values