I want to sort an object with objects in, and order by date. I get my objects from an API who delivers their API like this:
{
"2529354": {
"id": "2529354",
"name": "Burton Albion-Barnsley",
"tournament_stageFK": "850172",
"startdate": "2017-10-31T19:45:00+00:00",
"status_type": "notstarted",
"status_descFK": "1",
"n": "1",
"ut": "2017-06-21T10:32:10+00:00",
"tournamentFK": "11549",
"tournament_templateFK": "48",
"sportFK": "1",
"tournament_stage_name": "Championship",
"tournament_name": "2017/2018",
"tournament_template_name": "England 2",
"sport_name": "Soccer"
},
"2529355": {
"id": "2529355",
"name": "Cardiff City-Ipswich Town",
"tournament_stageFK": "850172",
"startdate": "2017-10-31T20:45:00+00:00",
"status_type": "notstarted",
"status_descFK": "1",
"n": "1",
"ut": "2017-06-21T10:32:10+00:00",
"tournamentFK": "11549",
"tournament_templateFK": "48",
"sportFK": "1",
"tournament_stage_name": "Championship",
"tournament_name": "2017/2018",
"tournament_template_name": "England 2",
"sport_name": "Soccer"
},
"2529364": {
"id": "2529364",
"name": "Reading-Nottingham Forest",
"tournament_stageFK": "850172",
"startdate": "2017-10-31T19:00:00+00:00",
"status_type": "notstarted",
"status_descFK": "1",
"n": "1",
"ut": "2017-06-21T10:32:11+00:00",
"tournamentFK": "11549",
"tournament_templateFK": "48",
"sportFK": "1",
"tournament_stage_name": "Championship",
"tournament_name": "2017/2018",
"tournament_template_name": "England 2",
"sport_name": "Soccer"
}
};
It could be hard to notice, but the startdate is different in those 3 objects. The API delivers like 17 objects, or games in this context, and they are not in order. I have tried using the sort-function, but as it is for arrays it doesn't really work.
Is there a possibility to sort it with Object.keys(object) or something similar?