5 ms·
Something I just learned about the other day was jid [0] to help query the json keys [0] https://github.com/fiatjaf/jiq https://github.com/fiatjaf/jiq
by snug 5y ago
Something I just learned about the other day was jid [0] to help query the json keys
[0] https://github.com/fiatjaf/jiq https://github.com/fiatjaf/jiq
- ducktective 5y agoYou can do the same thing using fzf preview mode
- maattdd 5y agoCan you elaborate ?
- gnyman 5y agoI guess they mean something like this, which I find useful at quickly iterating over jq fzf --print-query --preview-window wrap --no-clear --preview 'cat file.json | jq {q}' you can also pipe a curl in the above, but that will mean a lot of (slow) requests, so I have this snippet saved for running fzf --preview with jq on something from a web service curl -L https://datahub.io/core/covid-19/r/worldwide-aggregate.json > /tmp/foo && echo '' | fzf --print-query --preview-window wrap --no-clear --preview 'cat /tmp/foo | jq {q}' now if you write something like .[0]["Confirmed"] you will get a live preview of the result as you type I did not know about `jiq`, so thanks for that tip, it looks like it does the same or something similar, but without the extra cruft of storing a temp file
- aarchi 5y agoIt can be just `jq {q} file.json`. No need for `cat`.
- ducktective 5y ago`echo '' | fzf --print-query --preview "cat file.json | jq {q}"` https://news.ycombinator.com/item?id=23434018 https://news.ycombinator.com/item?id=23434018