jq
snap
Recipes
Basics
4
Filtering
3
Transform
3
Arrays
2
Formats
2
Advanced
1
All recipes
All recipes
Copy-paste jq one-liners, grouped by task.
Basics
Access Fields & Nested Keys with jq (.a.b.c)
2 min
Install jq (Linux, macOS, Windows)
2 min
Loop Over a JSON Array with jq (.[])
2 min
Pretty-Print & Minify JSON with jq (. and -c)
2 min
Filtering
Filter an Array of Objects by a Nested Key (jq)
3 min
jq has(), contains() & test() (Key Exists, Substring, Regex)
3 min
Filter JSON with jq select() (by Value or Condition)
3 min
Transform
Add, Delete & Rename Keys with jq
3 min
Build a New Object with jq {a: .x, b: .y}
3 min
Transform Each Item with jq map()
2 min
Arrays
Array length, flatten & slice with jq
2 min
Sort, Unique & Group with jq (sort_by, unique, group_by)
3 min
Formats
Raw String Output & Interpolation in jq (-r)
2 min
Convert JSON to CSV/TSV with jq (@csv, @tsv)
3 min
Advanced
jq --arg, slurp (-s) & recursive descent (..)
3 min