title: Array of key-value pair JSON object parsing
body: <p>Hi I have have a given array of JSON object in a file:</p>
  
  <p><strong>file.json:</strong></p>
  
  <pre><code>[ 
     {
        "id": "xccdf_saphana.content_profile_test1",
        "info": {
           "applicable_platforms": ["SUSE", "RHEL", "SUSE FOR SAP APP"],
           "applicable_workloads": "SalesPromo",
           "applicable_compliance": "CIS",
           "type":"System" 
        }
     },
     {
        "id": "xccdf_saphana.content_profile_test2",
        "info": {
           "applicable_workloads": "SalesPromo",
           "applicable_compliance": "CIS",
           "type":"System"
        }
     }
  ]
  </code></pre>
  
  <p>Below is the way I am reading it.</p>
  
  <pre><code>var obj = JSON.parse(fs.readFileSync(file.json, 'utf8')); // read the file
  myID = "xccdf_saphana.content_profile_test2";
  
  var myInfo = getInfobyID(myID);
  
  function getInfobyID(myID) {
      // Got messed up, tried changing JSON structure multiple time, so that I can easily parse it.
      for(var i=0; i &lt; obj.length; ++i) {
         if(obj[i].id == myID)
            return obj[i].info;
      }
  }
  </code></pre>
  
  <p>Is their any way I can optimize it, as I will be recursively searching for multiple myID later.</p>