JsonResult Class¶
Fields¶
-
DefaultContentTypes
()¶ The list of content-types used for formatting when [Microsoft.AspNet.Mvc.JsonResult.ContentTypes](Microsoft.AspNet.Mvc.JsonResult.yml) is null or empty.
public static readonly IReadOnlyList<MediaTypeHeaderValue> DefaultContentTypes
-
Constructors¶
-
JsonResult
(System.Object)¶ Creates a new [Microsoft.AspNet.Mvc.JsonResult](Microsoft.AspNet.Mvc.JsonResult.yml) with the given <paramref name=”value” />.
Arguments: - value (System.Object) – The value to format as JSON.
public JsonResult(object value)
-
JsonResult
(System.Object, JsonSerializerSettings) Creates a new [Microsoft.AspNet.Mvc.JsonResult](Microsoft.AspNet.Mvc.JsonResult.yml) with the given <paramref name=”value” />.
Arguments: - value (System.Object) – The value to format as JSON.
- serializerSettings (JsonSerializerSettings) – The @!:JsonSerializerSettings- to be used by the formatter.
public JsonResult(object value, JsonSerializerSettings serializerSettings)
-
JsonResult
(System.Object, Microsoft.AspNet.Mvc.IOutputFormatter) Creates a new [Microsoft.AspNet.Mvc.JsonResult](Microsoft.AspNet.Mvc.JsonResult.yml) with the given <paramref name=”value” />.
Arguments: - value (System.Object) – The value to format as JSON.
- formatter (Microsoft.AspNet.Mvc.IOutputFormatter) – The formatter to use, or <c>null</c> to choose a formatter dynamically.
public JsonResult(object value, IOutputFormatter formatter)
-
Properties¶
-
ContentTypes
()¶ Gets or sets the list of supported Content-Types.
Return type: System.Collections.Generic.IList{MediaTypeHeaderValue} public IList<MediaTypeHeaderValue> ContentTypes { get; set; }
-
Formatter
()¶ Gets or sets the formatter.
Return type: Microsoft.AspNet.Mvc.IOutputFormatter public IOutputFormatter Formatter { get; set; }
-
StatusCode
()¶ Gets or sets the HTTP status code.
Return type: System.Nullable{System.Int32} public int ? StatusCode { get; set; }
-
Value
()¶ Gets or sets the value to be formatted.
Return type: System.Object public object Value { get; set; }
-
Methods¶
-
ExecuteResultAsync
(Microsoft.AspNet.Mvc.ActionContext)¶ Arguments: - context (Microsoft.AspNet.Mvc.ActionContext) –
Return type: System.Threading.Tasks.Task
public override Task ExecuteResultAsync(ActionContext context)
-