Depends upon the type of controller you have really. If you are building a web API controller (deriving from ApiController
) then the return type is fine. You only need to use ActionResult
if you need to return a mix of return types (such as data, not found, etc). Because APIs normally return JSON (and assuming you haven't mucked with formatters at all) then the runtime will convert your return type to the appropriate format.
For MVC you should be returning ActionResult
. MVC normally assumes an HTML return value. For an API-like controller action in MVC you should wrap the return value in a call to JsonResult
to tell the runtime to return JSON. In that case the return type needs to be ActionResult
because that is what JsonResult
is derived from. Technically you could use JsonResult
directly but ActionResult
is generally the better route.