title: How to find depth of nodes in a nested json file?
body: <p>I found many solutions to find depth of nodes in a nested json file. but it throws me an error "maximum recursion depth exceeded " 
  when it set maximum recursion limit, it says "process exceeded with some error code" 
  As a part of my problem, I also need to find out key names of each node in the json file. </p>
  
  <p>example json :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>"attachments": {
              "data": [
                 {
                    "media": {
                       "image": {
                          "height": 400,
                          "src": "https://scontent.xx.fbcdn.net/v/t1.0-1/10250217_10152130974757825_8645405213175562082_n.jpg?oh=904c1785fc974a3208f1d18ac07d59f3&amp;oe=57CED94D",
                          "width": 400
                       }
                    },
                    "target": {
                       "id": "74286767824",
                       "url": "https://www.facebook.com/LAInternationalAirport/"
                    },
                    "title": "Los Angeles International Airport (LAX)",
                    "type": "map",
                    "url": "https://www.facebook.com/LAInternationalAirport/"
                 }
              ]
           }</code></pre>
  </div>
  </div>
  </p>
  
  <p>the output should be: </p>
  
  <p>nodes:
  [data [media [image[height,width,src]], target[id,url], title, type, url]]     </p>
  
  <p>depth: 4</p>