jq lessons
June 28, 2026•143 words
jq filters
map
- map(f) applies filter f to each element and collects results
- e.g. run an operation on every element of the array and output an array with the results
foreach
- foreach is like reduce but outputs at each step
foreach EXPR as $var (INIT; UPDATE; EXTRACT)
paths()
- paths() all paths as arrays
- leafpath paths to all leaf values
{"name":"Alice","age":30,"address":{"city":"Berlin","zip":"10115"}}paths(scalars) | join(".")orleaf_paths | join(".")- result:
"name"
"age"
"address.city"
"address.zip"
lessons/exercises
| type | resource | rating |
|---|---|---|
| exercises | https://learnjq.dev/ | 5 |
| examples | https://ishan.page/blog/2023-11-06-jq-by-example/ | 4 |
| exercises and examples | https://exercism.org/tracks/jq | 4 |
| examples | https://remysharp.com/drafts/jq-recipes | ? |
| examples | https://mosermichael.github.io/jq-illustrated/dir/content.html | ? |
| examples | https://jqlang.org/tutorial/ | ? |
sample data
https://services.odata.org/v4/northwind/northwind.svc/Customer_and_Suppliers_by_Cities
https://feed-prod.unitycms.io/2/newest?count=50