array of objects from database
[
{
campaign_definition_id: '125',
campaign_activity_id: '90',
member_id: 127863,
template_name: null,
template_id: '8498'
},
{
campaign_definition_id: '125',
campaign_activity_id: '90',
member_id: 130349,
template_name: null,
template_id: '8498'
},
{
campaign_definition_id: '125',
campaign_activity_id: '90',
member_id: 172867,
template_name: null,
template_id: '8498'
},
{
campaign_definition_id: '125',
campaign_activity_id: '91',
member_id: 127863,
template_name: null,
template_id: '9093'
},
{
campaign_definition_id: '125',
campaign_activity_id: '91',
member_id: 130349,
template_name: null,
template_id: '9093'
},
{
campaign_definition_id: '125',
campaign_activity_id: '91',
member_id: 172867,
template_name: null,
template_id: '9093'
}
]
Expected Result:
[
{
campaign_definition_id: '125',
campaign_activity_id: '90',
member_id: [127863,130349,172867],
template_name: null,
template_id: '8498'
}
{
campaign_definition_id: '125',
campaign_activity_id: '91',
member_id: [127863,130349,172867],
template_name: null,
template_id: '9093'
}
]
Hi, from the database the data is coming in array of objects, i need to take the same campaign_activity_id and put it in object and for that related campaign_activity_id , i need to take the member_id and push it to array, i have shown the expected result in above .please any one help me.....