Labs - JSON PATH - Introduction - KodeKloud
Expected output:
[
“KCMDD3435K”
]
Why does this json path query not work?
alpine-host ~ ➜ cat q7.json | jpath $.car.wheels[?(@.location == “rear-right”)].model
[]
alpine-host ~ ➜ cat q7.json
{
“car”: {
“color”: “blue”,
“price”: “$20,000”,
“wheels”: [
{
“model”: “KDJ39848T”,
“location”: “front-right”
},
{
“model”: “MDJ39485DK”,
“location”: “front-left”
},
{
“model”: “KCMDD3435K”,
“location”: “rear-right”
},
{
“model”: “JJDH3434KK”,
“location”: “rear-left”
}
]
}
}