答案 0 :(得分:1)
直接指定JSON:
return Json(new { yourvariablename = HttpStatusCodeResult });
如果您还需要返回视图:
var obj = new {
yourvariablename = HttpStatusCodeResult
};
return View(Json(obj, JsonRequestBehavior.AllowGet));
或者如果是局部视图:
var obj = new {
yourvariablename = HttpStatusCodeResult
};
return PartialView((Object)JsonConvert.SerializeObject(obj));