```
//Car Model having Make,Model,Color 

public class Car
{
    public string Make { get; set; }
    public string Model { get; set; }
    public string Color { get; set; }
}

...

//List that holds the objects

List<Car> cars = new List<Car>();

cars.Add(new Car {Make = "Honda", Model = "Accord", Color = "blue"});
cars.Add(new Car {Make = "Dodge", Model = "Caravan", Color = "green"});
cars.Add(new Car {Make = "Ford", Model = "Crown Victoria", Color = "red"});
cars.Add(new Car {Make = "Honda", Model = "Civic", Color = "blue" });

```

I am trying this 

```
var carGroups = cars.GroupBy(c => c.Color);

List<ColorGroup> obj = new List<ColorGroup>();
foreach (var group in carGroups)
{
    ColorGroup cg = new ColorGroup();
    cg.Color = group.Key;

    foreach (var item in group)
    {
        cg.cars.Add(item);
    }

    obj.Add(cg);
}

```

I need output like `json` format `Color` as `Key` of my `array`

```
{
    Color:red 
    [
        {
            Make = "Honda",
            Model = "Accord",
            Color = "blue"
        },
        {
            Make = "Honda",
            Model = "Accord",
            Color = "blue"
        }
    ]
}

```