I currently have an array in this format:
[
{
"name": "Size",
"values": [
"Small"
]
},
{
"name": "Colour",
"values": [
"Red"
]
},
{
"name": "Size",
"values": [
"Large"
]
},
{
"name": "Colour",
"values": [
"Green"
]
}
]
I wish to loop through the array and as a result have its structure looking like this:
[
{
"name": "Size",
"values": [
"Small", "Large"
]
},
{
"name": "Colour",
"values": [
"Red", "Green"
]
}
I wish for it to merge the "values" if the "names" match.