title: JsonPath - Filter Array and get only the first element
body: <p>Im trying to filter the elements of this JSON array to return only the first element it will find.</p>
  <pre><code>{
      &quot;elements&quot;: [{
          &quot;urn&quot;: &quot;urn:li:lyndaCourse:189800&quot;,
          &quot;details&quot;: {
              &quot;classifications&quot;: [{
                      &quot;associatedClassification&quot;: {
                          &quot;urn&quot;: &quot;urn:li:lyndaCategory:9331&quot;,
                          &quot;type&quot;: &quot;LIBRARY&quot;
                      }
                  },
                  {
                      &quot;associatedClassification&quot;: {
                          &quot;urn&quot;: &quot;urn:li:lyndaCategory:8982&quot;,
                          &quot;type&quot;: &quot;SUBJECT&quot;
                      }
                  },
                  {
                      &quot;associatedClassification&quot;: {
                          &quot;urn&quot;: &quot;urn:li:lyndaCategory:8920&quot;,
                          &quot;type&quot;: &quot;LIBRARY&quot;
                      }
                  }
              ]
          }
      }]
  }
  </code></pre>
  <p>But this results in an EMPTY array <code>[]</code>.</p>
  <p>I tried this JSONPATH query in <a href="https://jsonpath.herokuapp.com/" rel="nofollow noreferrer">https://jsonpath.herokuapp.com/</a></p>
  <p><code>$.elements[0].details.classifications..associatedClassification[?(@.type=='LIBRARY')][0]</code></p>
  <p>Expecting to get:</p>
  <pre><code>[{
      &quot;urn&quot;: &quot;urn:li:lyndaCategory:9331&quot;,
      &quot;type&quot;: &quot;LIBRARY&quot;
  }]
  </code></pre>