My data is structured in the following array format:
{
itemTitle: 'value example',
itemType: 'value example',
itemDescription: 'value example',
itemFamily: 'Asset',
},
{
itemTitle: 'value example',
itemType: 'value example',
itemDescription: 'value example',
itemFamily: 'Asset',
},
{
itemTitle: 'value example',
itemType: 'value example',
itemDescription: 'value example',
itemFamily: 'Periodic',
},
{
itemTitle: 'value example',
itemType: 'value example',
itemDescription: 'value example',
itemFamily: 'Periodic',
},
I am seeking to reformat this data into a key-value map, using itemFamily
as the key. The transformed output should resemble this structure:
{ Asset:
[ { itemTitle: 'value example',
itemType: 'value example',
itemDescription: 'value example',
itemFamily: 'Asset' },
{ itemTitle: 'value example',
itemType: 'value example',
itemDescription: 'value example',
itemFamily: 'Asset' } ],
Periodic:
[ { itemTitle: 'value example',
itemType: 'value example',
itemDescription: 'value example',
itemFamily: 'Periodic' },
{ itemTitle: 'value example',
itemType: 'value example',
itemDescription: 'value example',
itemFamily: 'Periodic' } ]
}
Any suggestions on how I can achieve this transformation?