title: Facing problem in retrieving a specific key name from a JSON api
body: <p>I have an API with the follwing JSON signature:</p>
  
  <pre><code>[{
     "id": 3,
     "impact": 7,
     "probability": 0.7,
     "title": "Risk 3"
  }]
  </code></pre>
  
  <p>Now I have lets say 3 similar objects in this format which actually demonstrates different risk names or numbers of a company. Now I need to find which risk number has the highest impact or probability. Also which risk has the highest RPZ, </p>
  
  <pre><code> RPZ = impact * probability 
  </code></pre>
  
  <p>I have managed to find the highest values of any of the properties in the json. But I have tried lot of ways to figure out the title or risk name associated to it. This is my target which I am not able to do. For example my goal is to get the highest value, lets say the impact from the above example, which is 7 and also to print out its risk name which is the title here. I was able to get the highest values but failing to print out its corresponding risk name or title.</p>
  
  <p>a liitle snippet....</p>
  
  <pre><code>var con = JSON.parse(body);
  
  var highImpact = Math.max.apply(Math, con.map(i =&gt; i.impact));
  </code></pre>
  
  <p>now from the above highImpact which is 7, now I need to pull out the corresponding risk name which would be......Risk 3. This is where I am struggling. </p>
  
  <p>I have checked a lot of similar questions asked by other developers in this community and also several web pages and blogs found in the internet. But nothing got me a solution till now. </p>
  
  <p>If some one of you can help me it would be really grateful</p>
  
  <p>v</p>
  
  <pre><code>ar Request = require('request');
  
  
  Request.get("https://webdevbootcamp-jay-jayantamgr.c9users.io/api/risks", (error, response, body) =&gt; {
      if(error)
      {
          return console.dir(error);
      }
      var con = JSON.parse(body);
  
      var highImpact = Math.max.apply(Math, con.map(i =&gt; i.impact));
  
  
      var highProb = Math.max.apply(Math, con.map(p =&gt; p.propability));
  
  
  
      let dictRPZ = [];
      function addRPZ(RiskName, RPZ){
          dictRPZ.push({RiskName, RPZ});
      }
  
      con.forEach(function(item){
          var RPZ = item.impact * item.propability;
          addRPZ(item.title, RPZ);
      });
  
  });
  </code></pre>
  
  <p>Expected result is to make a Dashboard and show the risk with highest impact, highest RPZ, live table of the risks and a moving average chart</p>