I have a list of Cards :
"Cards": [
{
"BIN": "308103",
"TIER": {
"Nums": "1",
"Phone": "111111111 *",
}
},
{
"BIN": "308103",
"TIER": {
"Nums": "2",
"Phone": "0000000000",
}
},
{
"BIN": "308516",
"TIER": {
"Nums": "",
"Phone": "00000000 *",
}
},
]
What i need to do is merge all cards having similair BIN into the attribute TIER of the first object in the list.
The requested output is :
"Cards": [
{
"BIN": "308103",
"TIER": [
{
"Nums": "1",
"Phone": "111111111 *",
},
{
"Nums": "2",
"Phone": "0000000000",
}
],
},
{...}
I did it using combined loops into each other but i want a performance-friendly solution.