Tuesday, March 1, 2011

JSON return format in ASP.NET MVC

Hi!

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:

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

How is this possible?

Thanks!

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

    public ActionResult Index()
    {
        return Json(yourModel);
    }
    
    Kordonme : Didn't have time to test it, but wouldn't it also return the properties names?

0 comments:

Post a Comment