JMESPath Examples Library
60+ practical JMESPath examples for filtering, projections, functions, and AWS-style JSON. Load any example into the playground and try it online.
Basic selections
10 examplesSelect all names
Simple projection
Expression
people[].nameInput JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
["Alice","Bob","Cara"]
First person
Index access
Expression
people[0]Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
{"name":"Alice","age":34,"city":"NYC","skills":["aws","python"]}Slice first two
Array slicing
Expression
people[:2].nameInput JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
["Alice","Bob"]
All skills nested
Nested projection
Expression
people[].skills[]Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
["aws","python","node","go","aws","k8s"]
Cities unique
Unique values
Expression
people[].city | unique(@)Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
["NYC","Seattle"]
Count people
length function
Expression
length(people)Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
3
Check first skill
Nested index
Expression
people[0].skills[0]Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
"aws"
Hash projection
Rename keys
Expression
people[].{Name: name, City: city}Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
[{"Name":"Alice","City":"NYC"},{"Name":"Bob","City":"Seattle"},{"Name":"Cara","City":"NYC"}]Deep wildcard
Wildcard on arrays
Expression
people[*]Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
[...]
Map with pipe
Pipe to map
Expression
people | map(&name, @)Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
["Alice","Bob","Cara"]
Filters & conditions
15 examplesAge > 30
Numeric filter
Expression
people[?age > `30`].nameInput JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
["Alice","Cara"]
City equals
String match
Expression
people[?city=='NYC']Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
[...]
Has skill aws
contains on array
Expression
people[?contains(skills, 'aws')].nameInput JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
["Alice","Cara"]
Missing skill
Negated contains
Expression
people[? !contains(skills, 'aws')].nameInput JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
["Bob"]
Between totals
Numeric range
Expression
orders[?total > `50` && total < `180`].idInput JSON
{
"orders": [
{ "id": "o-100", "total": 120.5, "items": [{"sku":"sku-1","qty":2},{"sku":"sku-2","qty":1}] },
{ "id": "o-101", "total": 42, "items": [{"sku":"sku-3","qty":5}] },
{ "id": "o-102", "total": 200, "items": [] }
]
}Output
["o-100"]
Empty items
length filter
Expression
orders[?length(items)==`0`].idInput JSON
{
"orders": [
{ "id": "o-100", "total": 120.5, "items": [{"sku":"sku-1","qty":2},{"sku":"sku-2","qty":1}] },
{ "id": "o-101", "total": 42, "items": [{"sku":"sku-3","qty":5}] },
{ "id": "o-102", "total": 200, "items": [] }
]
}Output
["o-102"]
Out of stock
Zero stock
Expression
inventory[?stock==`0`].nameInput JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
["gizmo"]
Stock low
< 5 units
Expression
inventory[?stock < `5`].nameInput JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
["gizmo"]
Tagged sale
Tag filter
Expression
inventory[?contains(tags, 'sale')]Input JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
[...]
City not NYC
Inequality
Expression
people[?city!='NYC'].nameInput JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
["Bob"]
Age and city
Multi condition
Expression
people[?age > `30` && city=='NYC'].nameInput JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
["Alice","Cara"]
Exists check
Truthy key
Expression
people[?skills]Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
[...]
Length of skills > 2
length on array
Expression
people[?length(skills) > `2`].nameInput JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
["Cara"]
Price above 1
Numeric filter inventory
Expression
inventory[?price > `1`].nameInput JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
["widget","gizmo"]
Not null city
Filter non-null
Expression
people[?city!=null]Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
[...]
Projections & transforms
12 examplesOrder totals
Project totals only
Expression
orders[].{OrderId:id, Total:total}Input JSON
{
"orders": [
{ "id": "o-100", "total": 120.5, "items": [{"sku":"sku-1","qty":2},{"sku":"sku-2","qty":1}] },
{ "id": "o-101", "total": 42, "items": [{"sku":"sku-3","qty":5}] },
{ "id": "o-102", "total": 200, "items": [] }
]
}Output
[{"OrderId":"o-100","Total":120.5},{"OrderId":"o-101","Total":42},{"OrderId":"o-102","Total":200}]Flatten order items
Flatten nested arrays
Expression
orders[].items[].{Sku: sku, Qty: qty}Input JSON
{
"orders": [
{ "id": "o-100", "total": 120.5, "items": [{"sku":"sku-1","qty":2},{"sku":"sku-2","qty":1}] },
{ "id": "o-101", "total": 42, "items": [{"sku":"sku-3","qty":5}] },
{ "id": "o-102", "total": 200, "items": [] }
]
}Output
[{"Sku":"sku-1","Qty":2},{"Sku":"sku-2","Qty":1},{"Sku":"sku-3","Qty":5}]Name to city map
Object projection
Expression
{NYC: people[?city=='NYC'].name, Seattle: people[?city=='Seattle'].name}Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
{"NYC":["Alice","Cara"],"Seattle":["Bob"]}Array of objects
Multi-select hash
Expression
people[].{Name:name, Skills:skills}Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
[...]
Totals summary
Aggregate with sum
Expression
sum(orders[].total)Input JSON
{
"orders": [
{ "id": "o-100", "total": 120.5, "items": [{"sku":"sku-1","qty":2},{"sku":"sku-2","qty":1}] },
{ "id": "o-101", "total": 42, "items": [{"sku":"sku-3","qty":5}] },
{ "id": "o-102", "total": 200, "items": [] }
]
}Output
362.5
Inventory value
Multiply fields
Expression
inventory[].{Name:name, Value: price * stock}Input JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
[{"Name":"widget","Value":55},{"Name":"gizmo","Value":0},{"Name":"bolt","Value":8.8}]Team counts
Nested projection per team
Expression
departments[].teams[].{Team:name, Headcount:headcount}Input JSON
{
"departments": [
{ "name": "Engineering", "teams": [{"name":"Platform","headcount":12},{"name":"Data","headcount":7}] },
{ "name": "Support", "teams": [{"name":"Tier1","headcount":15},{"name":"Tier2","headcount":5}] }
]
}Output
[{"Team":"Platform","Headcount":12},{"Team":"Data","Headcount":7},{"Team":"Tier1","Headcount":15},{"Team":"Tier2","Headcount":5}]Default value
Handle missing tags
Expression
inventory[].{Name:name, FirstTag: tags[0] || 'none'}Input JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
[{"Name":"widget","FirstTag":"sale"},{"Name":"gizmo","FirstTag":"featured"},{"Name":"bolt","FirstTag":"none"}]Rename and sort
Projection with sort
Expression
sort_by(people, &age)[].{Name:name, Age:age}Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
[...]
Cities with counts
Group projection
Expression
{NYC:length(people[?city=='NYC']), Seattle:length(people[?city=='Seattle'])}Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
{"NYC":2,"Seattle":1}Item quantities per order
Map with pipe
Expression
orders[].{id:id, quantities: items[].qty}Input JSON
{
"orders": [
{ "id": "o-100", "total": 120.5, "items": [{"sku":"sku-1","qty":2},{"sku":"sku-2","qty":1}] },
{ "id": "o-101", "total": 42, "items": [{"sku":"sku-3","qty":5}] },
{ "id": "o-102", "total": 200, "items": [] }
]
}Output
[...]
Extract totals and ids
Two arrays
Expression
{Ids: orders[].id, Totals: orders[].total}Input JSON
{
"orders": [
{ "id": "o-100", "total": 120.5, "items": [{"sku":"sku-1","qty":2},{"sku":"sku-2","qty":1}] },
{ "id": "o-101", "total": 42, "items": [{"sku":"sku-3","qty":5}] },
{ "id": "o-102", "total": 200, "items": [] }
]
}Output
{"Ids":["o-100","o-101","o-102"],"Totals":[120.5,42,200]}Functions
17 examplesMax total
max_by
Expression
max_by(orders, &total).idInput JSON
{
"orders": [
{ "id": "o-100", "total": 120.5, "items": [{"sku":"sku-1","qty":2},{"sku":"sku-2","qty":1}] },
{ "id": "o-101", "total": 42, "items": [{"sku":"sku-3","qty":5}] },
{ "id": "o-102", "total": 200, "items": [] }
]
}Output
"o-102"
Min stock
min_by
Expression
min_by(inventory, &stock).nameInput JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
"gizmo"
Sort by price desc
reverse + sort
Expression
reverse(sort_by(inventory, &price))[].nameInput JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
["gizmo","widget","bolt"]
Average price
avg
Expression
avg(inventory[].price)Input JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
6.9
Join tags
join
Expression
inventory[].{name:name, tags: join(',', tags)}Input JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
[...]
Type of fields
type function
Expression
people[].{name:name, type:type(age)}Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
[...]
Keys of object
keys
Expression
keys(inventory[0])Input JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
["name","stock","price","tags"]
Values of object
values
Expression
values(inventory[0])Input JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
["widget",10,5.5,["sale","blue"]]
Not null selection
not_null
Expression
not_null(inventory[0].tags[0], 'fallback')Input JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
"sale"
Merge objects
merge
Expression
merge({a:1}, {b:2})Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
{"a":1,"b":2}To array
to_array
Expression
to_array(people[0].name)Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
["Alice"]
To string
to_string number
Expression
to_string(inventory[0].stock)Input JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
"10"
To number
to_number
Expression
to_number('42')Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
42
Ceiling price
ceil
Expression
ceil(inventory[0].price)Input JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
6
Floor price
floor
Expression
floor(inventory[0].price)Input JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
5
Starts with tag
starts_with
Expression
inventory[0].tags[?starts_with(@, 's')]Input JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
["sale"]
Ends with check
ends_with
Expression
people[?ends_with(city, 'C')].nameInput JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
["Alice","Cara"]
Complex queries
10 examplesPipeline filter then project
Pipe usage
Expression
people | [?age > `30`] | [].{Name:name, City:city}Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
[...]
Top spender order
max_by with pipe
Expression
max_by(orders, &total) | {Id: id, Total: total}Input JSON
{
"orders": [
{ "id": "o-100", "total": 120.5, "items": [{"sku":"sku-1","qty":2},{"sku":"sku-2","qty":1}] },
{ "id": "o-101", "total": 42, "items": [{"sku":"sku-3","qty":5}] },
{ "id": "o-102", "total": 200, "items": [] }
]
}Output
{"Id":"o-102","Total":200}Flatten items
Flatten without parent id
Expression
orders[].items[]Input JSON
{
"orders": [
{ "id": "o-100", "total": 120.5, "items": [{"sku":"sku-1","qty":2},{"sku":"sku-2","qty":1}] },
{ "id": "o-101", "total": 42, "items": [{"sku":"sku-3","qty":5}] },
{ "id": "o-102", "total": 200, "items": [] }
]
}Output
[{"sku":"sku-1","qty":2},{"sku":"sku-2","qty":1},{"sku":"sku-3","qty":5}]Group cities
Buckets
Expression
{NYC: people[?city=='NYC'], Others: people[?city!='NYC']}Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
[...]
Skills with counts
Flatten then count
Expression
people[].skills[] | group_by(@, @) | [].{skill: @[0], count: length(@)}Input JSON
{
"people": [
{ "name": "Alice", "age": 34, "city": "NYC", "skills": ["aws", "python"] },
{ "name": "Bob", "age": 28, "city": "Seattle", "skills": ["node"] },
{ "name": "Cara", "age": 41, "city": "NYC", "skills": ["go", "aws", "k8s"] }
]
}Output
[...]
Ensure CSV-ready shape
Normalize with defaults
Expression
inventory[].{Name:name, Stock: stock || `0`, Price: price || `0`}Input JSON
{
"inventory": [
{ "name": "widget", "stock": 10, "price": 5.5, "tags": ["sale","blue"] },
{ "name": "gizmo", "stock": 0, "price": 15, "tags": ["featured"] },
{ "name": "bolt", "stock": 44, "price": 0.2, "tags": [] }
]
}Output
[...]
Filter items over qty 2
Nested filter
Expression
orders[].items[?qty > `2`]Input JSON
{
"orders": [
{ "id": "o-100", "total": 120.5, "items": [{"sku":"sku-1","qty":2},{"sku":"sku-2","qty":1}] },
{ "id": "o-101", "total": 42, "items": [{"sku":"sku-3","qty":5}] },
{ "id": "o-102", "total": 200, "items": [] }
]
}Output
[...]
Sum quantities per order
math with sum
Expression
orders[].{id:id, totalQty: sum(items[].qty)}Input JSON
{
"orders": [
{ "id": "o-100", "total": 120.5, "items": [{"sku":"sku-1","qty":2},{"sku":"sku-2","qty":1}] },
{ "id": "o-101", "total": 42, "items": [{"sku":"sku-3","qty":5}] },
{ "id": "o-102", "total": 200, "items": [] }
]
}Output
[...]
Sort by headcount
Nested sort
Expression
departments[].teams | [].sort_by(@, &headcount)[-1]Input JSON
{
"departments": [
{ "name": "Engineering", "teams": [{"name":"Platform","headcount":12},{"name":"Data","headcount":7}] },
{ "name": "Support", "teams": [{"name":"Tier1","headcount":15},{"name":"Tier2","headcount":5}] }
]
}Output
[...]
Department to team names
map with projection
Expression
map(&{Department: name, Teams: teams[].name}, departments)Input JSON
{
"departments": [
{ "name": "Engineering", "teams": [{"name":"Platform","headcount":12},{"name":"Data","headcount":7}] },
{ "name": "Support", "teams": [{"name":"Tier1","headcount":15},{"name":"Tier2","headcount":5}] }
]
}Output
[...]