I have an array of objects similar to the following:
[
{
"id": "one",
"tags": {
"my.key": "true"
}
},
{
"id": "two",
}
]
How can I select all "id" values for each object containing a tag where "my.key" is "true"?
You can use a select
with .tags["my.key"] == "true"
and get only the id
field :
jq '.[] | select(.tags["my.key"] == "true") | .id' data.json