............................ Input......................................................
[ { Id: 1, Name: 'Red', optionName: 'Color' },
{ Id: 2, Name: 'Yellow', optionName: 'Color' },
{ Id: 3, Name: 'Blue', optionName: 'Color' },
{ Id: 4, Name: 'Green', optionName: 'Color' },
{ Id: 7, Name: 'Black', optionName: 'Color' },
{ Id: 8, Name: 'S', optionName: 'Size' },
{ Id: 11, Name: 'M', optionName: 'Size' },
{ Id: 12, Name: 'L', optionName: 'Size' },
{ Id: 13, Name: 'XL', optionName: 'Size' },
{ Id: 14, Name: 'XXL', optionName: 'Size' } ]
I have will group by optionName and doing two row in main array like..
........................Ouput ........................
[ {Name:'Color',Data:[{Id: 1, Name: 'Red'},
{Id: 2, Name: 'Yellow'},
{Id: 3, Name: 'Blue'},
{Id: 4, Name: 'Green'},
{Id: 7, Name: 'Black'}] },
{ Name:'Size',Data:[{Id: 8, Name: 'S'},
{ Id: 11, Name: 'M',},
{ Id: 12, Name: 'L',},
{ Id: 13, Name: 'XL'},
{ Id: 14, Name: 'XXL'}]
}]
Any one help me . how do it in java-script or node js ..