There's JSON with some product data, as an example:
{
"sku": 123,
"product": {
"name": "Some name",
"images": {
"normalImage": "http://somelink.com/1.jpg",
"bigImage": "http://somelink.com/1b.jpg"
}
}
}
I want to pick the image link, but bigImage exists only in some products, so sometimes I need to pick normalImage instead.
The obvious solution looks like:
jmespath.search('product.images.bigImage') or jmespath.search('product.images.normalImage')
but I feel it could be done better. How to do it in an optimal way using JMESPath syntax?