I'm trying to create a jq filter for JSON, similar to How to filter an array of objects based on values in an inner array with jq? - but even using that as a basis doesn't seem to be giving me the results I want.
Here's my example json
[{"id":"0001","tags":["one","two"]},{"id":"0002", "tags":["two"]}]
I want to return a list of IDs where tags contains "one" (not partial string match, full element match).
I have tried some variations, but can't get the filter right.
. - map(select(.resources[] | contains("one"))) | .[] .id
Returns "0001","0002"
Have also tried ... .resources[].one)) | ...
but always get full list when trying to filter by "one" and expecting to only get 0001
Where am I filtering wrong? (have about 30 minutes experience with jq, so please excuse my ignorance if it's something obvious :)