title: Sum JSON Data by using Group by in jQuery
body: <p>Following data is i am getting.</p>
  
  <pre><code>var data =[{"Type1":2,"Type2":0,"Type3":6,"Date":"2015-01-27","Source":"Web"},
            {"Type1":2,"Type2":2,"Type3":0,"Date":"2015-02-27","Source":"Mobile"},
            {"Type1":3,"Type2":0,"Type3":7,"Date":"2015-02-27","Source":"Unknown"},
            {"Type1":4,"Type2":5,"Type3":9,"Date":"2015-02-27","Source":"Web"}]
  </code></pre>
  
  <p>I want to sum this data by doing Group by Date like this,</p>
  
  <pre><code>var result= 
                [{"Type1":2,"Type2":0,"Type3":6,"Date":"2015-01-27"},
                {"Type1":9,"Type2":7,"Type3":16,"Date":"2015-02-27"}]
  </code></pre>
  
  <p>For this i have written following jquery code, but its not working. Please suggest me changes.</p>
  
  <pre><code>    var objects = JSON.stringify(data)
        var grphDates = new Array();
              var groupedObjects = new Array();
              $.each(objects, function (ix, obj) {
                  var existingObj;
                  if ($.inArray(obj.Date, grphDates) &gt;= 0) {
                      existingObj = $.grep(groupedObjects, function (o, si) { return o.Date === obj.Date; });
                      existingObj.Type1 += obj.Type1;
                      existingObj.Type2 += obj.Type2;
                      existingObj.Type3 += obj.Type3;
                    } else {
                      groupedObjects.push(obj);
                      grphDates.push(obj.Date);
                  }
              });
  </code></pre>