title: JsonPath: getting first element in string list
body: <p>On <a href="https://jsonpath.com" rel="nofollow noreferrer">https://jsonpath.com</a> I have below example, using expression</p>
  <pre><code>$.phoneNumbers[?(@.id &lt; 3)].number
  </code></pre>
  <p>on below JSON object.</p>
  <pre><code>{
    &quot;firstName&quot;: &quot;John&quot;,
    &quot;lastName&quot; : &quot;doe&quot;,
    &quot;age&quot;      : 26,
    &quot;phoneNumbers&quot;: [
      {
        &quot;type&quot;  : &quot;iPhone&quot;,
        &quot;number&quot;: &quot;0123-4567-1111&quot;,
        &quot;id&quot;: 1
      },
      {
        &quot;type&quot;  : &quot;home&quot;,
        &quot;number&quot;: &quot;0123-4567-2222&quot;,
        &quot;id&quot;: 2
      },
      {
        &quot;type&quot;  : &quot;home&quot;,
        &quot;number&quot;: &quot;0123-4567-3333&quot;,
        &quot;id&quot;: 3
      }
    ]
  }
  </code></pre>
  <p>Result is</p>
  <pre><code>[
    &quot;0123-4567-1111&quot;,
    &quot;0123-4567-2222&quot;
  ]
  </code></pre>
  <hr />
  <h3>Question</h3>
  <p>I only want the first string <code>&quot;0123-4567-1111&quot;</code>, but appending <code>[0]</code> to my expression does not work. Expression <code>$.phoneNumbers[?(@.id &lt; 3)].number[0]</code> gives result <code>[&quot;0&quot;,&quot;0&quot;]</code>. How can I get the first returned string?</p>