MVC 4 and JsonResult format
问题 have a problem with the result format of this code public JsonResult getCategorias(int? id) { var res = from c in db.Categorias where (( id.HasValue && c.CategoriaPadre == id.Value) || (!id.HasValue && c.CategoriaPadre == null)) select new { id = c.Id, label = c.Descripcion }; return this.Json(res, JsonRequestBehavior.AllowGet); } this return a json : [{"id":21,"label":"Marketing3"},{"id":22,"label":"Marketing4"}] But i need a json with this format: {"21":"Marketing3","22":"Marketing4"} What