title: recursively parse json in javascript to retrieve certain keys' values
body: <p>I am new to javascript and every time i try learning it, I just end up in an immense amount of frustration and disgust ! No offense, but this is my opinion or perhaps I am too stupid to not understand how it works at all. </p>
  
  <p>I have a simple requirement. I have a pretty deeply nested dictionary (which is what it is called in many backend languages) at hand. To be more specific it is the raw text of a postman collection. The collection itself could have multiple nested directories. </p>
  
  <p>Now all I want to do is to be able to parse this dictionary and do something with it recursively.</p>
  
  <p>For example, if I had to do the same in python I would do it as simply as :</p>
  
  <pre><code> def createRequests(self, dic):
          total_reqs = 0
          headers = {}
          print type(dic)
          keys = dic.keys()
          if 'item' in keys:
              print "Folder Found. Checking for Indivisual request inside current folder . .  \n"
  
              self.item_list = dic.get('item')
  
              for each_item in self.item_list:    
                  self.folder.append(self.createRequests(each_item))
  
  
          else:
              print "Found Indivisual request. Appending. . .  \n"
              temp_list = []
              temp_list.append(dic)
              self.requestList.append(temp_list)
              return self.requestList
  </code></pre>
  
  <p>where <code>dic</code> would be my dictionary that I want to parse. 
  Is there any simple and straight forward way to do the same in Javascript?</p>
  
  <p>Let's just say all I want to do is that if I have a text file that has properly formed json data in it and whose contents have been read into <code>dataReadFromFile</code> and then it has been converted into a JSON as :</p>
  
  <p><code>var obj = JSON.parse(dataReadFromFile);</code></p>
  
  <p>is there any simple and easy way to convert this JSON to dictionary or the <code>dataReadFromFile</code> directly into a dictionary such that I can say something like dictioanry.keys() if I wanted a list of the keys in it.</p>
  
  <p>Note that the content of the file is not fixed. It may have multiple levels of nesting, which may not be known beforehand. </p>