I want to sort my JSON by date, and if there are multiple entries for a specific date, group all of them into the specific date.
This is my JSON:
[ 
   { 
      "id":"3",
      "time":"20:00",
      "hometeam":"AC Milan",
      "awayteam":"Juventus",
      "prediction":"Under 2.5",
      "odds":"1.75",
      "competition":"Serie A",
      "status":"lost",
      "date":"01-11-2019"
   },
   { 
      "id":"4",
      "time":"21:00",
      "hometeam":"FCSB",
      "awayteam":"Dinamo",
      "prediction":"Draw",
      "odds":"1.12",
      "competition":"Liga 1",
      "status":"",
      "date":"01-11-2019"
   },
   { 
      "id":"1",
      "time":"16:00",
      "hometeam":"Chelsea",
      "awayteam":"Arsenal",
      "prediction":"Over 2.5",
      "odds":"1.32",
      "competition":"Premier League",
      "status":"won",
      "date":"31-10-2019"
   },
   { 
      "id":"2",
      "time":"18:00",
      "hometeam":"Manchester United",
      "awayteam":"Liverpool",
      "prediction":"1x2",
      "odds":"1.45",
      "competition":"Premier League",
      "status":"won",
      "date":"31-10-2019"
   }
]Here's the AJAX and HTML:
function updateList() {   
jQuery.ajax({
type: "GET",
url: url
dataType: 'json',
timeout: 5000,
crossDomain: true,
cache: false,
success: function(data) {
console.log(JSON.stringify(data));
var groupedData = _.groupBy(data, function(d){return d.date});
//console.log(groupedData);
var htmlText = data.map(function(o){
return `  
<div class="norm"><i class="icon-hourglass-time"></i>${o.date}</div>
<ul class="stage clearfix">
<li class="scene">
 <!-- <div class="trigger"></div> -->
 <div class="face" ontouchend="return true">
  <a class="calendar-hour poster tasklist-gray">
   <div class="max-constrain">
    <div class="first-20">
     <div class="cal-from"><strong>${o.time} <small>GMT</small></strong>
     </div>
    </div>
    <div class="second-45">
     <div class="teams">${o.hometeam}
      <br><small>vs</small>
      <br>${o.awayteam}</div><em><i class="fa fa-map-marker"></i>${o.competition}</em>
    </div>
    <div class="third-35 last-column">
     <div class="over-under">
      <div class="over-under-icon">
       <div class="over-under-text-over uppercase">
        <div class="over-under-number">${o.prediction}</div>
        <div class="odd-number">
        ${o.odds}
        </div>
        
       </div>
       <div class="touch-section uppercase"><span class="statusValue">${o.status}</span></div>
      </div>
     </div>
    </div>
   </div>
  </a>
  <div class="info">
   <div class="result-top-unch uppercase"><i class="fa fa-pause"></i>…</div>
  </div>
 </div>
</li>
</ul>
`;
});
jQuery('.container-fullscreen').append(htmlText);
},
error: function(data) {
console.log(JSON.stringify(data));
}
});
}Thanks for the help!
 
     
    