JsonResult Sınıf

Tanım

Verilen nesneyi JSON olarak biçimlendiren bir eylem sonucu.

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
Devralma
JsonResult
Uygulamalar

Oluşturucular

JsonResult(Object)

Verilen valueile yeni JsonResult bir oluşturur.

JsonResult(Object, JsonSerializerSettings)

Verilen valueile yeni JsonResult bir oluşturur.

JsonResult(Object, Object)

Verilen valueile yeni JsonResult bir oluşturur.

Özellikler

ContentType

Yanıtın MediaTypeHeaderValue Content-Type üst bilgisini temsil eden öğesini alır veya ayarlar.

SerializerSettings

Seri hale getirici ayarlarını alır veya ayarlar.

kullanırken System.Text.Json, bu bir örnek olmalıdır: JsonSerializerOptions

kullanırken Newtonsoft.Json, bu bir örneği JsonSerializerSettingsolmalıdır.

StatusCode

HTTP durum kodunu alır veya ayarlar.

Value

Biçimlendirilecek değeri alır veya ayarlar.

Yöntemler

ExecuteResult(ActionContext)

Eylem yönteminin sonuç işlemini zaman uyumlu olarak yürütür. Bu yöntem, bir eylem yönteminin sonucunu işlemek için MVC tarafından çağrılır.

(Devralındığı yer: ActionResult)
ExecuteResultAsync(ActionContext)

Eylem yönteminin sonuç işlemini zaman uyumsuz olarak yürütür. Bu yöntem, bir eylem yönteminin sonucunu işlemek için MVC tarafından çağrılır.

Şunlara uygulanır