Ranking order in array

Hi Expert,

i am using some analytic tools to predict a modal result, there will be only 3 result , A_result, B_result & C_result, array just like below


And array item sequence based on the result probability, the highest probability will come first, so some times the C_result may appear in the first place.


My question is how can i transform the array alway be in alphabetical order regardless the probability? then i can easily do some calculation on next step!!


Hi @Louis_kwok, can you confirm the full JSON data structure you’re currently working with in n8n? You can extract it like so:

Recording 2022-08-29 at 11.35.32

On a very general level, the order of object keys is not guaranteed in Javascript and you might want to consider using a genuine array instead. But let’s take a look at the data you’re processing first :slight_smile: