changing outputted json format

Dec 9, 2010 at 4:31 PM

Hello,

i use an action to return JSON in the following format;

[{"gainers":"CAP","date":"Dec  9 ","Open":30.87,"Close":32.41,"change":1.54},{"gainers":"AP","date":"Dec  9 ","Open":20.00,"Close":21.00,"change":1.00}]

what i want is to return JSON in the following format;

[{"dailygainers":{"gainers":"CAP","date":"Dec  9 ","Open":30.87,"Close":32.41,"change":1.54}},{"dailygainers":{"gainers":"AP","date":"Dec  9 ","Open":20.00,"Close":21.00,"change":1.00}}]

How can i do this using JSON.NET and MVC 2

 

The code i used to achieve the first JSON Output is;

 

[HttpGet]
    public ActionResult MarketList()
    {
        var mkt = db.GetDailyList();
        return Json(mkt, JsonRequestBehavior.AllowGet);
    }