title: How to parse through a json array?
body: <p>By using  node js I generate the array below(2) , by parsing through multiple json files for a particular value. </p>
  
  <p>My json files contains a list of IDs with their status : isAvailable or undefined.<a href="https://i.stack.imgur.com/AlpVk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AlpVk.png" alt="enter image description here"></a></p>
  
  <p>So In my code i parse through all my json files but looking only for the first ID and get the statuts of Availability in the picture bellow. When it's true t means that the ID is available. As you can see the name of the file, it's the date and the hour the json was produced.</p>
  
  <p>So What I want to achieve is write a function or anything simple, where i go through the array you can see in the picture.
  Example:
  We can see that the status is available for the first file, I wanna recover first file name with status available</p>
  
  <blockquote>
    <p>("{ fileName: '2017-03-17T11:39:36+01:00', 
           Status: Available }"</p>
  </blockquote>
  
  <p>when the status stop being available, in our example that would be here ( { fileName: '2017-04-06T11:19:17+02:00', contents: undefined } ) 
  get: </p>
  
  <blockquote>
    <p>{ fileName: '2017-04-06T11:19:17+02:00', Status: unavailable }</p>
  </blockquote>
  
  <p>(2)
  <a href="https://i.stack.imgur.com/bjNcZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bjNcZ.png" alt="enter image description here"></a></p>
  
  <p>So here is part of my code where I generate this array : </p>
  
  <pre><code>Promise.mapSeries(filenames, function(fileName) {
        var contents = fs
          .readFileAsync("./availibility/" + fileName, "utf8")
          .catch(function ignore() {});
        return Promise.join(contents, function(contents) {
          return {
            fileName,
            contents
          };
        });
      }).each(function(eachfile) {
        if(eachfile.contents){
          jsonobject = JSON.parse(eachfile.contents);
          if(jsonobject &amp;&amp; jsonobject.hasOwnProperty('messages'))         
         // console.log(jsonobject.messages[0].message.results[2]); 
          eachfile.contents = jsonobject.messages[0].message.results[1].isAvailable;
        } 
        eachfile.fileName = eachfile.fileName.substring('revision_'.length,(eachfile.fileName.length-5));
      console.log(eachfile);
  
      })
  </code></pre>
  
  <p>May someone help me please</p>
  
  <p>Thank you,</p>