What is JsonResultType in MVC?

Category: C SharpWhat is JsonResultType in MVC?
Editor">Editor Staff asked 2 years ago

What is JsonResultType in MVC?

2 Answers
Editor">Editor Staff answered 2 years ago

Action methods on controllers return JsonResult (JavaScript Object Notation result) that can be used in an AJAX application. This class is inherited from the “ActionResult” abstract class. Here Json is provided one argument which must be serializable. The JSON result object that serializes the specified object to JSON format.

 

  1. public JsonResult JsonResultTest()  
  2. {  
  3.     return Json(“Hello My Friend!”);  
  4. }   
Editor">Editor Staff answered 2 years ago

Action methods on controllers return JsonResult (JavaScript Object Notation result) that can be used in an AJAX application. This class is inherited from the “ActionResult” abstract class. Here Json is provided one argument which must be serializable. The JSON result object that serializes the specified object to JSON format.

 

  1. public JsonResult JsonResultTest()  
  2. {  
  3.     return Json(“Hello My Friend!”);  
  4. }