title: how to sum up all values with same keys in an object inside an array and get their average
body: <p>so i have this json and i need to add the values of each the same keys that the object has and will also compute their average, here is my json </p>
  
  <pre><code>var arraySeries = [{"country":"United States","data":2},
                     {"country":"Venezuela","data":0},
                     {"country":"Singapore","data":3},
                     {"country":"United States","data":0},
                     {"country":"Germany","data":2},
                     {"country":"United States","data":2},
                     {"country":"Canada","data":2},
                     {"country":"Germany","data":-4}];
  </code></pre>
  
  <p>and here is my expected result </p>
  
  <pre><code>var newArraySeries = [{"country":"United States","data":[1.33333]},
                     {"country":"Venezuela","data":[0]},
                     {"country":"Singapore","data":[3]},
                     {"country":"Canada","data":[2]},
                     {"country":"Germany","data":[-1]}];
  </code></pre>
  
  <p>the data in newArraySeries should be in array, I'm going to use it in my highchart map.. i did some google research but i can't find any article like this.I hope you can help me</p>