title: JsonPath: How to check if a field has some value or not through JsonPath?
body: <p>I am finding it a little difficult to understand how to write a jsonpath that will tell me whether there is some value present or not in the field.</p>
  
  <p>For example: Consider this json: </p>
  
  <pre><code>{
    "firstName": "John",
    "lastName" : "doe",
    "age"      : 26,
    "address"  : {
      "streetAddress": "naist street",
      "city"         : "Nara",
      "postalCode"   : "630-0192"
    },
    "phoneNumbers": [
      {
        "type"  : "iPhone",
        "number": "0123-4567-8888"
      },
      {
        "type"  : "home",
        "number": "0123-4567-8910"
      }
    ]
  }
  </code></pre>
  
  <p>And if I write: $.phoneNumbers[?(@.type.length>0)]</p>
  
  <p>It gives me this result: </p>
  
  <pre><code>'0' ...
    'type' =&gt; "iPhone"
    'number' =&gt; "0123-4567-8888"
  '1' ...
    'type' =&gt; "home"
    'number' =&gt; "0123-4567-8910"
  </code></pre>
  
  <p>I did this here: <a href="http://jsonpath.com/" rel="noreferrer">http://jsonpath.com/</a></p>
  
  <p>So if suppose I want to know if there is any value in the number field inside the phonenumber or if it's empty , then what should be my jsonpath? I tried various things, but couldn't figure it out. </p>
  
  <p>Thanks!</p>