jq Playground
A playground for the jq command-line JSON processor.
JSON Input
jq Filter
Output
About jq
`jq` is a lightweight and flexible command-line JSON processor. It's like `sed` for JSON data – you can use it to slice, filter, map, and transform structured data with ease. It's an invaluable tool for anyone who works with APIs or JSON files.
jq Cheat Sheet
| Operator | Description | Example |
|---|---|---|
. | Identity: outputs the entire input JSON. | . |
.foo | Object Identifier: extracts the value of the "foo" key. | .users |
.[] | Array Iterator: outputs each element of an array. | .users[] |
| | Pipe: chains filters together, passing the output of one to the input of the next. | .users[] | .name |
select(foo) | Select: keeps only the elements for which the expression `foo` is true. | select(.age > 25) |
map(foo) | Map: applies the filter `foo` to each element of an array. | map({name, city}) |
{key: .val} | Object Construction: creates a new JSON object. | {userName: .name} |