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)

使用指定的 value 建立新的 JsonResult

JsonResult(Object, JsonSerializerSettings)

使用指定的 value 建立新的 JsonResult

JsonResult(Object, Object)

使用指定的 value 建立新的 JsonResult

屬性

ContentType

取得或設定 , MediaTypeHeaderValue 表示回應的 Content-Type 標頭。

SerializerSettings

取得或設定序列化程式設定。

使用 System.Text.Json 時,這應該是 的實例 JsonSerializerOptions

使用 Newtonsoft.Json 時,這應該是 的 JsonSerializerSettings 實例。

StatusCode

取得或設定 HTTP 狀態碼。

Value

取得或設定要格式化的值。

方法

ExecuteResult(ActionContext)

同步執行動作方法的結果作業。 MVC 會呼叫這個方法來處理動作方法的結果。

(繼承來源 ActionResult)
ExecuteResultAsync(ActionContext)

以非同步方式執行動作方法的結果作業。 MVC 會呼叫這個方法來處理動作方法的結果。

適用於