I've set up this test method on a controller to strip out any complication to it. Based off of all the results I've found from searching this should work. I'm not sure what I'm missing here.
public JsonResult test()
{
return Json(new { id = 1 });
}
This is the error I get.
Cannot implicitly convert type 'System.Web.Http.Results.JsonResult' to 'System.Web.Mvc.JsonResult'
you should return a JsonResult instead of just Json
public JsonResult test()
{
var result = new JsonResult();
result.Data = new
{
id = 1
};
result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
return result;
}