title: How to cross reference a property in JMESPath or JSONPath?
body: <p>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.</p>
  <p>Below is my JSON:</p>
  <pre><code>{
      &quot;properties&quot;: {
          &quot;DefaultVMTypeID&quot;: &quot;RT&quot;,
          &quot;VM&quot;: {
              &quot;measurements&quot;: [
                  {
                      &quot;vm&quot;: 45.62,
                      &quot;vmString&quot;: &quot;45.62&quot;,
                      &quot;vmID&quot;: &quot;RT&quot;,
                      &quot;vmPathID&quot;: &quot;osdu&quot;,
                      &quot;vmTypeID&quot;: &quot;RT&quot;,
                      &quot;vmUnitOfMeasureID&quot;: &quot;m&quot;
                  },
                  {
                      &quot;vm&quot;: 65,
                      &quot;vmString&quot;: &quot;65&quot;,
                      &quot;vmID&quot;: &quot;MT&quot;,
                      &quot;vmPathID&quot;: &quot;sample&quot;,
                      &quot;vmTypeID&quot;: &quot;MT&quot;,
                      &quot;vmUnitOfMeasureID&quot;: &quot;m&quot;
                  },
                  {
                      &quot;vm&quot;: 32,
                      &quot;vmString&quot;: &quot;32&quot;,
                      &quot;vmID&quot;: &quot;MT&quot;,
                      &quot;vmPathID&quot;: &quot;osduschemas&quot;,
                      &quot;vmTypeID&quot;: &quot;MT&quot;,
                      &quot;vmUnitOfMeasureID&quot;: &quot;m&quot;
                  },
                  {
                      &quot;vm&quot;: 95,
                      &quot;vmString&quot;: &quot;95&quot;,
                      &quot;vmID&quot;: &quot;MT&quot;,
                      &quot;vmPathID&quot;: &quot;schema&quot;,
                      &quot;vmTypeID&quot;: &quot;MT&quot;
                  }
              ]
          }
      }
  }
  </code></pre>
  <p>I want to get all the measurements whose <strong>vmId</strong> is equal to <strong>DefaultVMTypeID</strong>.</p>
  <p>I tried below query:
  [properties.DefaultVerticalmeasurementTypeID, properties.Verticalmeasurements.measurements[?VerticalmeasurementTypeID]] | map(&amp;[1].VerticalmeasurementTypeID==@[0], @)</p>
  <p>but when applying <strong>map</strong> to the array @ refers to the element of the array and inside map there is no way I an access <strong>DefaultVMTypeID</strong>.</p>
  <p>I have also tried transforming each element of an object.</p>
  <p>Any leads would be appreciated.</p>