Actionresult vs JSONresult

Sameer More picture Sameer More · Mar 6, 2013 · Viewed 34.1k times · Source

I have 2 questions:

  1. What is the difference between JSONResult and ActionResult?

  2. When to use JSONResult in MVC?

Answer

SLaks picture SLaks · Mar 6, 2013

ActionResult is an abstract class that an action can return.

The helper methods in Controller (eg, Json(), Content(), View(), ...) return different concrete classes that inherit ActionResult, including JsonResult.

You should declare your action methods as returning ActionResult, so that they have the freedom to return any concrete result class.