JSON返回格式在ASP。NET MVC

时间:2021-07-15 17:59:38

Actually my question is simple. I think. But unfortunately, Google can't help me this time. I want to return a JSON in my view in this format:

实际上我的问题很简单。我认为。但不幸的是,谷歌这次帮不了我。我想在我的视图中以这种格式返回JSON:

[[0,"Mark Kordon",null,"My HTML - Mark Kordon"],[1,"John Doe",null,"John Doe Markup"]]

How is this possible?

这怎么可能?

1 个解决方案

#1


4  

Sounds like all you want to do is return your model from the controller as a JsonResult:

听起来你所要做的就是将你的模型作为JsonResult从控制器返回:

public ActionResult Index()
{
    return Json(yourModel);
}

#1


4  

Sounds like all you want to do is return your model from the controller as a JsonResult:

听起来你所要做的就是将你的模型作为JsonResult从控制器返回:

public ActionResult Index()
{
    return Json(yourModel);
}