I have a json file as below.
{
'003': 'key',
'001': 'hool',
'101': 'com',
'023': 'good'
}
And I want to sort this according to number of key.
{
'001': 'hool',
'003': 'key',
'023': 'good',
'101': 'com'
}
I made this sort method. But I can modify this to adjust on my case.
distances.sort((a, b) => {
return a.num < b.num ? -1 : a.num > b.num ? 1 : 0;
});
Could you give me an idea for this? Thank you for reading it.