I got the following results.
$ jq '.[].a,.[].b' <<< '[{"a": 1}, {"b": 2}]'
1
null
null
2
$ jq '.[] | select(.a or .b)' <<< '[{"a": 1}, {"b": 2}]'
{
"a": 1
}
{
"b": 2
}
But I want to search either "a" and "b" and the output that I would like is this.
1
2
What is the proper way to perform this or
operation? Thanks.