=> back to xoc3.io

2021-08-04 - an intro to jq

i heard about the jq command sometime last year and i've had it installed for many months now, but i didn't need to use it until today.

=> jq on github

installation with pacman is straightforward:

sudo pacman -S jq

i'm guessing jq stands for "json query", but i couldn't find a source for that to know for sure. some nice things that i noticed immediately when i started using jq are:

one of the main reasons to use jq is for json filtering. Here are some simple examples:

json='{"a": {"b": ["c", "d", {"e": "f"}]}}'

echo $json | jq .         # prints: {"a": {"b": ["c", "d", {"e": "f"}]}}
echo $json | jq .a        # prints: {"b": ["c", "d", {"e": "f"}]}
echo $json | jq .a.b[0]   # prints: "c"
echo $json | jq .a.b[2].e # prints: "f"
Proxy Information
Original URL
gemini://xoc3.io/blog/2021-08-04
Status Code
Success (20)
Meta
text/gemini;charset=UTF-8
Capsule Response Time
635.638603 milliseconds
Gemini-to-HTML Time
0.688082 milliseconds

This content has been proxied by September (ba2dc).