💾 Archived View for xoc3.io › blog › 2021-08-04 captured on 2023-04-26 at 13:18:08. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-04-28)
-=-=-=-=-=-=-
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.
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"