I am working with a JSON dataset provided via CSV file from my client. I have processed the CSV into a JSON format.
I have the following result (dataset reduced from 1304 to 2 for readability)
"1": {
"title": "Abercarn RFC",
"address": "High Street, Abercarn, Newport, Gwent",
"postcode": "NP11 5GQ",
"category": "Club",
"website": "http://abercarn.rfc.wales",
},
"2": {
"title": "Abercarn RFC",
"address": "High Street, Abercarn, Newport, Gwent",
"postcode": "NP11 5GQ",
"category": "Seniors",
"website": "http://abercarn.rfc.wales",
}
I want to be able to loop through my array (pre-json_encode($array)) and merge these objects but preserve both the category values into a CSV list, so the ideal output in this case will be
"category": "Club, Seniors"
I am happy to simply merge all the other fields as they are consistently the same across the data set.