Class JsonResult
Defines a model for a result of a request that is serialized as JSON using Json.NET.
Inheritance
System.Object
JsonResult
Implements
IStatusCodeActionResult
Namespace: MADE.Web.Mvc.Responses
Assembly: MADE.Web.Mvc.dll
Syntax
public class JsonResult : ActionResult
Constructors
| Improve this Doc View SourceJsonResult(Object, HttpStatusCode, JsonSerializerSettings)
Initializes a new instance of the JsonResult class with the object to serialize.
Declaration
public JsonResult(object value, HttpStatusCode statusCode = null, JsonSerializerSettings serializerSettings = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value object to serialize. |
HttpStatusCode | statusCode | The expected result HTTP status code. |
JsonSerializerSettings | serializerSettings | The Json.Net serializer settings for serializing the result. |
Properties
| Improve this Doc View SourceSerializerSettings
Gets the Json.Net serializer settings for serializing the result.
Declaration
public JsonSerializerSettings SerializerSettings { get; }
Property Value
Type | Description |
---|---|
JsonSerializerSettings |
StatusCode
Gets the expected result HTTP status code.
Declaration
public int? StatusCode { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
Value
Gets the value object to serialize.
Declaration
public object Value { get; }
Property Value
Type | Description |
---|---|
System.Object |
Methods
| Improve this Doc View SourceExecuteResultAsync(ActionContext)
Executes the result operation of the action method asynchronously writing the Value to the response.
Declaration
public override async Task ExecuteResultAsync(ActionContext context)
Parameters
Type | Name | Description |
---|---|---|
ActionContext | context | The context in which the result is executed. |
Returns
Type | Description |
---|---|
Task | An asynchronous operation. |
Implements
IStatusCodeActionResult