JsonResult 类

定义

将给定对象的格式设置为 JSON 的操作结果。

public ref class JsonResult : Microsoft::AspNetCore::Mvc::ActionResult
public ref class JsonResult : Microsoft::AspNetCore::Mvc::ActionResult, Microsoft::AspNetCore::Mvc::IActionResult, Microsoft::AspNetCore::Mvc::Infrastructure::IStatusCodeActionResult
public class JsonResult : Microsoft.AspNetCore.Mvc.ActionResult
public class JsonResult : Microsoft.AspNetCore.Mvc.ActionResult, Microsoft.AspNetCore.Mvc.IActionResult, Microsoft.AspNetCore.Mvc.Infrastructure.IStatusCodeActionResult
type JsonResult = class
    inherit ActionResult
type JsonResult = class
    inherit ActionResult
    interface IStatusCodeActionResult
    interface IActionResult
type JsonResult = class
    inherit ActionResult
    interface IActionResult
    interface IStatusCodeActionResult
Public Class JsonResult
Inherits ActionResult
Public Class JsonResult
Inherits ActionResult
Implements IActionResult, IStatusCodeActionResult
继承
JsonResult
实现

构造函数

名称 说明
JsonResult(Object, JsonSerializerSettings)

JsonResult使用给定 value的 创建新的 。

JsonResult(Object, Object)

JsonResult使用给定 value的 创建新的 。

JsonResult(Object)

JsonResult使用给定 value的 创建新的 。

属性

名称 说明
ContentType

获取或设置 MediaTypeHeaderValue 表示响应的 Content-Type 标头的 。

SerializerSettings

获取或设置序列化程序设置。

使用 System.Text.Json时,应为 的实例 JsonSerializerOptions

使用 Newtonsoft.Json时,这应该是 的 JsonSerializerSettings实例。

StatusCode

获取或设置 HTTP 状态代码。

Value

获取或设置要格式化的值。

方法

名称 说明
ExecuteResult(ActionContext)

同步执行操作方法的结果操作。 MVC 调用此方法来处理操作方法的结果。

(继承自 ActionResult)
ExecuteResultAsync(ActionContext)

异步执行操作方法的结果操作。 MVC 调用此方法来处理操作方法的结果。

适用于