Basics
Identity filter.
Select a single field.name
Select by field value.[] | select(.status == "active")
Access nested field.config.database.host
Pipe chain.users[] | select(.role == "admin") | .name
Arrays
Flatten nested arrays[.[][]]
Map and transform[.items[] | {id, upper: (.name | ascii_upcase)}]
Sort by fieldsort_by(.score) | reverse
First and last elements{first: first, last: last}
Objects
Rename keys.[] | {user: .name, mail: .email}
to_entries pivotto_entries | map({(.key): .value})
Merge objects.[0] * .[1]
Extract keys and values{keys: keys, values: [.[]]}
String & Math
Split and join strings.path | split("/") | map(select(. != "")) | join(" > ")
String interpolation.[] | "\(.name) scored \(.score) points"
Sum an array of numbers.prices | add
Regex test[.[] | select(test("@"))]
Real-World Patterns
Group by + countgroup_by(.type) | map({type: .[0].type, count: length})
Unique values[.[].tags[]] | unique | sort
Extract from API response.data.results[] | {id, name, status}
JSON to CSV rows.[] | [.name, (.age | tostring), .city] | join(",")
Key=value pairs to object[.[] | split("=") | {(.[0]): .[1]}] | add
jq
-rNo quotes
-sArray wrap
-nNo input
-cOne line
runningloading...
JSON Input
Output

Paste JSON and write a filter to begin.