JsonResult Class¶
An action result which formats the given object as JSON.
- Namespace
Microsoft.AspNetCore.Mvc- Assemblies
- Microsoft.AspNetCore.Mvc.Formatters.Json
Syntax¶
public class JsonResult : ActionResult, IActionResult
-
class
Microsoft.AspNetCore.Mvc.JsonResult
Constructors¶
-
JsonResult(System.Object)¶ Creates a new
Microsoft.AspNetCore.Mvc.JsonResultwith the given <em>value</em>.Arguments: value (System.Object) – The value to format as JSON. public JsonResult(object value)
-
JsonResult(System.Object, Newtonsoft.Json.JsonSerializerSettings) Creates a new
Microsoft.AspNetCore.Mvc.JsonResultwith the given <em>value</em>.Arguments: - value (System.Object) – The value to format as JSON.
- serializerSettings (Newtonsoft.Json.JsonSerializerSettings) – The
Newtonsoft.Json.JsonSerializerSettingsto be used by the formatter.
public JsonResult(object value, JsonSerializerSettings serializerSettings)
-
Properties¶
-
Microsoft.AspNetCore.Mvc.JsonResult.ContentType¶ Gets or sets the
Microsoft.Net.Http.Headers.MediaTypeHeaderValuerepresenting the Content-Type header of the response.Return type: System.String public string ContentType { get; set; }
-
Microsoft.AspNetCore.Mvc.JsonResult.SerializerSettings¶ Gets or sets the
Newtonsoft.Json.JsonSerializerSettings.Return type: Newtonsoft.Json.JsonSerializerSettings public JsonSerializerSettings SerializerSettings { get; set; }
-
Microsoft.AspNetCore.Mvc.JsonResult.StatusCode¶ Gets or sets the HTTP status code.
Return type: System.Nullable<System.Int32> public int ? StatusCode { get; set; }
-
Microsoft.AspNetCore.Mvc.JsonResult.Value¶ Gets or sets the value to be formatted.
Return type: System.Object public object Value { get; set; }
-