title: Extract data from objects nested at different depths in a huge JSON file
body: <p>I used following code to grab data from a huge json format file.</p>
  
  <pre><code>_ITEM_L1=`cat json.list | jq .item[].length | wc -l`
  for (( i=0;i&lt;$_ITEM_L1;i++ ));
  do
      _ITEM_L2=`cat json.list | jq .item[$i].item[].length | wc -l`
      for (( j=0;j&lt;$_ITEM_L2;j++ ));
      do
          _API_NAME=`cat json.list | jq .item[$i].item[$j].name`
          _API_URL=`cat json.list | jq .item[$i].item[$j].request.url.raw`
          echo $_API_NAME
          echo $_API_URL;
      done;
  done
  </code></pre>
  
  <p>At First I think its only 2 level, but when I run the script I found its more than 2 level, it could be 3 or 4 even 5 or more.
  So my question is how to know how many levels in a json file before I start the iterate?</p>
  
  <pre><code>item0
      |
      item0
           |
           item0
                name:
                url:
           item1
                name:
                url:
           item2
                name:
                url:
      item1
           |
           item0
                |
                item0
                     name:
                     url:
                item1
                     name:
                     url:
           item1
                |
                item0
                     name:
                     url:
                item1
                     name:
                     url:
                item2
                     name:
                     url:
  item1
       |
       item0
            name:
            url:
       item1
            name:
            url:
       item2
            name:
            url:
  .
  .
  .
  .
  .
  .
  </code></pre>