A JSON data has 2 arrays (categories & applets) as shown below. Each applet can belong to many categories as per the data.
categories = ['Investments', 'Operations', 'Performance'];
applets = [
{
name: 'Performance Snapshot',
categories: ['Performance'],
},
{
name: 'Commitment Widget',
categories: ['Investments'],
},
{
name: 'CMS',
categories: ['Investments', 'Performance'],
},
];
I need to convert that JSON data to use them as category wise as shown below. How to do this in Typescript??
categories = [
{
'name': 'Performance',
'applets': ['CMS', 'Performance Snapshot']
},
{
'name' : 'Investments',
'applets' : ['Commitment Widget', 'CMS']
},
{
'name' : 'Operations',
'applets' : []
}
]