I am presenting JSON data that looks like this:
[
{
"id": "i_1",
"name": "abc",
"address": [
{
"city": [
"city1",
"city2"
]
},
{
"city": [
"city1",
"city2"
]
}
]
},
{
"id": "i_2",
"name": "def",
"address": [
{
"city": []
},
{
"city": []
}
]
}
]
My objective is to extract only the data where the city
array is not empty. Based on the above example, the output should be the first element with an id of i_1
.
Can you explain how the json
can be filtered using the JMESPath library?