title: Determine which level i'm in the JSON tree
body: <p>I may have a simple problem, but i can't figure it out. If I have a multy denominational JSON array like so:</p>
  
  <pre><code>[
      {
          "name":"one",
          "children":
          [
              {
                  "name":"two",
                  "children":
                  [
                      {
                          "name":"two",
                          "children": []
                      }, 
                      ... 
                  ]
  
              },
              ...
          ]
  
      }
  ]
  </code></pre>
  
  <p>I want to determine what level i'm at. If I was going to loop true all the first entities what will be printed is bellow: </p>
  
  <pre><code>one -|
       two -&gt; View Children
  </code></pre>
  
  <p>Once "<code>View Children</code>" will be clicked:</p>
  
  <pre><code>one -|
       two -| 
            three -&gt; View Children || Go Back.
  </code></pre>
  
  <p>And if "<code>Go Back</code>" is clicked we go back to:</p>
  
  <pre><code>one -|
       two -&gt; View Children
  </code></pre>
  
  <p>So It's similar to a Hierarchy. I can't figure out how to make the back button work. I was able to figure out the go forward using this peace of code:</p>
  
  <pre><code>level = obj; // OBJ is the json data.
  
  function inside(events){
      temp = "";
      for (i in events) {
        temp += "&lt;li id='"+events[i].id+"' class='"+events[i].type+"' index='"+i+"''&gt;&amp;nbsp;&amp;nbsp;"+events[i].name+ "&lt;/li&gt;";
      }
      return temp;
  }
  
  text += inside(obj);
  
  $('#filebrowser').on('click','li.folder',function(e){
  
      var index =  $(this).attr('index');
      var html = "&lt;li class='folder back' index='"+index+"'&gt;back&lt;/li&gt;";
  
      if(level[index].children){
          html = html + inside(level.[index].children);
          level = level[index].children;
      } 
  
      $('#filebrowser').html(html);
      e.stopPropagation();
  
  });
  </code></pre>
  
  <p>I just wanted to say this is can be dynamic, many go back's should occur, so storing the back obj in a variable is not going to cut it.</p>