title: node construct object with reading json files (and folders) recursively
body: <p>I was not been able to find a solution to this specific problem, hence the query...</p>
  
  <p>Basically, given the following directory structure...</p>
  
  <pre><code>rootfolder 
  --- foldera
      --- foldera1
          ---scenario1.json
  --- folderb
      --- folderb1
          ---scenario2.json
  </code></pre>
  
  <p>I want to create following json object using node.js</p>
  
  <pre><code>{
    "rootfolder": {
      "foldera": {
        "foldera1": {
          "scenario1": {
            "id": 1,
            "name": "foobar"
          }
        }
      },
      "folderb": {
        "folderb1": {
          "scenario2": {
            "id": 202,
            "address": "somestreet",
            "postcode": 12334343
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>so it uses folder and file names as json node and whenever it finds the json file it parses its content into object.</p>
  
  <p>Any idea?</p>