I am trying to use jmespath for my querying my json and I am trying to access a property which is at a higher level.
Below is my JSON:
{
"properties": {
"DefaultVMTypeID": "RT",
"VM": {
"measurements": [
{
"vm": 45.62,
"vmString": "45.62",
"vmID": "RT",
"vmPathID": "osdu",
"vmTypeID": "RT",
"vmUnitOfMeasureID": "m"
},
{
"vm": 65,
"vmString": "65",
"vmID": "MT",
"vmPathID": "sample",
"vmTypeID": "MT",
"vmUnitOfMeasureID": "m"
},
{
"vm": 32,
"vmString": "32",
"vmID": "MT",
"vmPathID": "osduschemas",
"vmTypeID": "MT",
"vmUnitOfMeasureID": "m"
},
{
"vm": 95,
"vmString": "95",
"vmID": "MT",
"vmPathID": "schema",
"vmTypeID": "MT"
}
]
}
}
}
I want to get all the measurements whose vmId is equal to DefaultVMTypeID.
I tried below query: [properties.DefaultVerticalmeasurementTypeID, properties.Verticalmeasurements.measurements[?VerticalmeasurementTypeID]] | map(&[1].VerticalmeasurementTypeID==@[0], @)
but when applying map to the array @ refers to the element of the array and inside map there is no way I an access DefaultVMTypeID.
I have also tried transforming each element of an object.
Any leads would be appreciated.