I have this JSON object:
{
id: {
name: "BBCommercialPropertyStructureFloodCoverage",
},
carrierData: null,
link: [
{
key: "Location",
select: {
key: "ARRAY_INDEX",
value: 0,
},
},
{
key: "structure",
select: {
key: "ARRAY_INDEX",
value: 1,
},
},
{
key: "Coverage",
select: {
key: "ARRAY_INDEX",
value: 0,
},
},
],
},
I have several of these objects with different index values. For example, if I want to match on this id/name: "BBCommercialPropertyStructureFloodCoverage"
and also that the location is value 0 and the structure is value 1, how do I do this using jmespath?
I have this so far:
const floodCoverageQuery = [?id.name=='BBCommercialPropertyStructureFloodCoverage' && link[key=='Location' && select.value==0]] && link[key=="structure" && select.value==1]]
Is this right?