I have been playing around with this for a few hours now and have had not much luck.
My current JSON looks like this: https://pastebin.com/TSmWFA2g
"10-10-2019 12:00AM":[ 
  { 
     "speed":33,
     "latitude":-11.2588112,
     "longitude":100.8249533
  },
  { 
     "speed":33,
     "latitude":-11.2381112,
     "longitude":100.82509
  },
  { 
     "speed":31,
     "latitude":-11.827312,
     "longitude":100.8242733
  }
],
"10-10-2019 12:01AM":[ 
  { 
     "speed":29,
     "latitude":-11.2902112,
     "longitude":100.8202849
  },
  { 
     "speed":26,
     "latitude":-11.2826432,
     "longitude":100.3760333
  }
]
What I am attempting to do is for each date find the entry that has the highest "speed" and remove the other entries under that date (or create a new array with the single entry).
EDIT 01: I have now tried:
function my_sort($a,$b)
{
return $b['speed'] - $a['speed'];
}
usort($finalData,"my_sort");
echo json_encode($finalData);
This sorts the data by speed but the JSON now does not include the date found in the original JSON.
[{"speed":33,"latitude":-11.2588112,"longitude":100.82509}, 
{"speed":33,"latitude":-11.2588112,"longitude":100.82509}, 
{"speed":31,"latitude":-11.2588112,"longitude":100.82509}, 
{"speed":31,"latitude":-11.2588112,"longitude":100.82509}, 
{"speed":33,"latitude":-11.2588112,"longitude":100.82509}, 
{"speed":32,"latitude":-11.2588112,"longitude":100.82509}, 
{"speed":24,"latitude":-11.2588112,"longitude":100.82509}, 
{"speed":16,"latitude":-11.2588112,"longitude":100.82509},]
 
     
     
    