3 ms·
By far the most useful jq operator I've used is recursive descent: `..`. It can take a positively heinous json blob and pick out the attributes/keys you care ab
by MattyRad 6y ago
By far the most useful jq operator I've used is recursive descent: `..`. It can take a positively heinous json blob and pick out the attributes/keys you care about. For example:
Yikes:
> wget -O - -q 'https://reddit.com/r/unixporn/new.json' https://reddit.com/r/unixporn/new.json' | jq
I just want the links:
> wget -O - -q 'https://reddit.com/r/unixporn/new.json' https://reddit.com/r/unixporn/new.json' | jq '..|.permalink? | select(.)'
- Arkanosis 6y agoI've been casually using jq for years, yet you just managed to put three things I didn't know about it and will use extensively from now on in a single one-liner. Thank you!
- hiram112 6y agoThank you. This will be added to my 'How To JQ' list, since I'm convinced now that I'll never fully understand its syntax enough to master it outright.
- mahalol 6y agoOh, would you mind sharing your list please?