Given an input like this:
[
{
"a": "foo",
"b": [ 1, 2, 3 ]
},
{
"a": "bar",
"b": [ ]
},
{
"a": "baz",
"b": [ 2 ]
}
]
I want to filter out the elements that have a zero-length array for their b
property to give:
[
{
"a": "foo",
"b": [ 1, 2, 3 ]
},
{
"a": "baz",
"b": [ 2 ]
}
]
How do I do this with JMESPath?
You can use
[?length(b)>'0']