Is it possible to collect recursive-descent results into a single array with jq
?
Would flatten
help? Looks so to me, but I just cannot get it working. Take a look how far I am now at https://jqplay.org/s/6bxD-Wq0QE, anyone can make it working?
BTW,
.data.search.edges[].node | {name, topics: ..|.topics?}
works, but I want all topics from the same node to be in one array, instead of having samename
in all different returned results.flatten
alone will give meCannot iterate over null
, and- that's why I'm trying to use
map(select(.? != null))
to filter thenull
s out. However, I'd getCannot iterate over null
as well for mymap-select
.
So now it all comes down to how to filter out those null
s?
UPDATE:, by "collect into a single array" I meant to get something like this:
[
{
"name": "leumi-leumicard-bank-data-scraper",
"topics": ["banking", "leumi", "api", "puppeteer", "scraper", "open-api"]
}
]
instead of having same name
duplicated in all different returned results. Thus recursively descends seems to me to be the option, but I'm open to any solution as long as I can get result like above. Is that possible? Thx.