How to use jq wildcard
If you don't care about the keys in the object you're searching, you could just search the values of the object using []
which you could then filter to your desired results.
.details.addresses[][] | select(.version == 4).addr
If on the other hand you wanted to select keys that has a version 4, you could use to_entries
to do this:
.details.addresses | to_entries[] | select(any(.value[]; .version == 4)).key
If, as suggested by part of the question, you want to confine the search to key names starting with "ext":
.details.addresses
| to_entries[]
| select(.key|startswith("ext"))
| .value[]
| select(.version == 4)
| .addr
Towards the other end of the spectrum of permissiveness:
.details.addresses
| ..
| objects
| select(.version==4)
| .addr