I'm having a problem manipulating an array of objects inside another array.I created an example to explain what I need. So here we have this array:
array1 =
[
{
"first": "A",
"second": [
"one"
]
},
{
"first": "A",
"second": [
"three"
]
},
{
"first": "C",
"second": [
"four"
]
},
{
"first": "D",
"second": [
"one"
]
},
{
"first": "C",
"second": [
"three"
]
},
]
I've been trying to create a logic to manipulate this array and return something like this:
result =
[
{
"first": "A",
"second": [
"one",
"three"
]
},
{
"first": "C",
"second": [
"three",
"four"
]
},
{
"first": "D",
"second": [
"one"
]
},
]