title: Loop to get value based on key name
body: <p>Below is the JSON response I am getting. From this JSON response, I want to get the value of &quot;fees&quot; based on &quot;detailComponent&quot; with &quot;FULL_FEE&quot; only. But, somehow it gets the last value of &quot;detailComponent&quot; with &quot;SUB_FEE&quot; or others which is not correct.</p>
  <p>I am sure not how to make this for loop condition to fix my issue. Can help to guide pls?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let data = {
      "status": "SUCCESS",
      "result": {
          "originData": {
              "detailType": "MSG",
              "origin": [
                  {
                      "details": [
                          {
                              "detailComponent": "FULL_FEE",
                              "fees": 13564.00
                          },
                          {
                              "detailComponent": "SUB_FEE",
                              "fees": 8207.60
                          }
                      ]
                  }
              ]
          }
      }
  }
  
  var getData = data.result.originData.origin[0].details[0].detailComponent;
  console.log('getData: ', getData);</code></pre>
  </div>
  </div>
  </p>