I am currently creating an API that combines outputs from 2 APIs (which are already immutable/impossible to change). I need to get their data and then sort them based on the attribute created_date
.
This is the output format from the 1st API:
{
"data" : [
{
"created_date": "2021-11-21",
"name": "test 1"
}
]
...
And this is the output format from the 2nd API:
{
"data" : [
{
"created_date": "21-10-2021 09:21:37",
"name": "test 1"
}
]
...
Then I combined them into an array, but I wonder how to do the sorting based on the created_date
in efficient way? Because, if I use loops to sort one-by-one, it would be highly inefficient in my case where the data already hundreds of records on both APIs. Any help is greatly appreciated. Thank you in advance.