title: How can I get specific values using a key from json using AngularJS foreach
body: <p>I have JSON  object  returned from elastic search like below
  <img src="https://i.stack.imgur.com/tbS0A.png" alt="enter image description here"></p>
  
  <p>How can i get the <strong>Agent</strong> and <strong>calls</strong> value from this JSON.</p>
  
  <pre><code>$scope.results = client
                  .query(oQuery.query($scope.queryTerm || '*'))
                  .doSearch().then(function (body) {
               $scope.results = body.hits.hits;
               var resultstofilter = $scope.results;
               var log = [];
                angular.forEach(results, function(result, key) {
                  angular.forEach(result, function(value, key) {
                     this.push(key + ': ' + value);
                   }, log);
                }, log);
               console.log(resultstofilter);
              }, function (error) {
                console.trace(error.message);
                });;
  </code></pre>
  
  <p>The above prints the same objects again and again.</p>