IList<Customer> Customers =
flat.GroupBy(cust => new { cust.ReferenceNumber, cust.Name, cust.Address })
.Select(c => new Customer()
{
ReferenceNumber = c.Key.ReferenceNumber,
Name = c.Key.Name,
Address = c.Key.Address,
Orders = c.Select(o => new Order()
{
OrderId = o.OrderId,
ProductName = o.ProductName,
Description = o.Description,
Amount = o.Amount
}).ToList()
}).ToList()
Is taking a flat list and converting it into a nested object possible in Javascript? A generic solution that is??