1
How can I reduce the array by grouping it by the key/value and the keys I receive are dynamic?
Input:
[
{
"CORAS": "PP007"
},
{
"CORAS": "PP008"
},
{
"COREN": "PP007"
},
{
"COREN": "PP008"
},
{
"COREN": "PP002"
},
{
"COREN": "VNL020"
},
{
"COREN": "VNL121"
}
]
Output:
{
"CORAS": ["PP007", "PP008"],
"COREN": ["PP007", "PP008", "PP002", "VNL020", "VNL121"]
}
What have you tried? See the answers here, the solution is very similar.
– bfavaretto
You already tried something Tiago?
– LeAndrade
Being the most honest, I did not understand which function I can use to perform this map
– Tiago Paza
We’d need to see how you did it to help, edit the question with what you’ve already tried to do, maybe the question will be reopened.
– LeAndrade