i'm using ASP MVC 5. I have an action in a controller that return a json object:
[HttpGet]
public JsonResult GetUsers()
{
return Json(....., JsonRequestBehavior.AllowGet);
}
Now i want to use the JSON.Net library and i see that in ASP MVC 5 is yet present. In effect i can write
using Newtonsoft.Json;
without import the library from NuGet.
Now i've tried to write:
public JsonResult GetUsers()
{
return JsonConvert.SerializeObject(....);
}
But i have an error during compilation: I cann't convert the return type string to JsonResult. How can i use the Json.NET inside an action? What is the correct return type of an action?