jq — JSON Processing

JSON processing with jq across 9 disciplines. Each discipline is a directory — add sub-pages as it grows without restructuring. All commands copy-paste-runnable on Arch Linux.

Disciplines

Discipline Description

Basics

Keys, dot access, nested paths, raw output (-r), compact (-c), iterators, pipes

Selection

select, test, has, type checks, regex filtering, compound conditions, contains, any/all

Construction

Build JSON from shell, --arg/--argjson, object construction, to_entries/from_entries, merge

Output

@csv, @tsv, @html, @json, @base64, @uri, string interpolation, join, split

Aggregation

Slurp (-s), group_by, sort_by, unique_by, min_by/max_by, add, length

Infrastructure

ip -j, nmcli, systemctl, ss, journalctl, pacman — system JSON queries

API

curl | jq pipelines, pagination, authentication, error handling, multi-source joins

Transforms

map, reduce, recurse, walk, path expressions, env/$ENV, string transforms

Gotchas

Null handling, string vs number, empty vs null, try-catch, shell quoting, operator precedence

See Also