語言

JsonOutputFormatter 類別

定義

TextOutputFormatterJSON 內容的 。

public ref class JsonOutputFormatter : Microsoft::AspNetCore::Mvc::Formatters::TextOutputFormatter
public class JsonOutputFormatter : Microsoft.AspNetCore.Mvc.Formatters.TextOutputFormatter
type JsonOutputFormatter = class
    inherit TextOutputFormatter
Public Class JsonOutputFormatter
Inherits TextOutputFormatter
繼承

建構函式

名稱 Description
JsonOutputFormatter(JsonSerializerSettings, ArrayPool<Char>)

初始化新的 JsonOutputFormatter 執行個體。

屬性

名稱 Description
PublicSerializerSettings

Newtonsoft.Json.JsonSerializerSettings取得用來設定 的 Newtonsoft.Json.JsonSerializer 。

SerializerSettings

Newtonsoft.Json.JsonSerializerSettings取得用來設定 的 Newtonsoft.Json.JsonSerializer 。

SupportedEncodings

取得這個 TextOutputFormatter 支援的可變動字元編碼集合。 寫入資料時會使用編碼。

(繼承來源 TextOutputFormatter)
SupportedMediaTypes

取得這個 OutputFormatter 所支援的可變動媒體類型專案集合。

(繼承來源 OutputFormatter)

方法

名稱 Description
CanWriteResult(OutputFormatterCanWriteContext)

判斷這 IOutputFormatter 是否可以序列化指定型別的物件。

(繼承來源 OutputFormatter)
CanWriteType(Type)

傳回值,指出這個序列化程式是否可以寫入指定的型別。

(繼承來源 OutputFormatter)
CreateJsonSerializer()

在序列化期間呼叫 以建立 Newtonsoft.Json.JsonSerializer 。

CreateJsonWriter(TextWriter)

在序列化期間呼叫 以建立 Newtonsoft.Json.JsonWriter 。

GetSupportedContentTypes(String, Type)

取得 和 支援的內容類型 IOutputFormatterobjectTypecontentType 篩選清單。

(繼承來源 OutputFormatter)
SelectCharacterEncoding(OutputFormatterWriteContext)

Encoding根據提供的內容類型,決定讀取或寫入 HTTP 實體主體所支援編碼的最佳方式。

(繼承來源 TextOutputFormatter)
WriteAsync(OutputFormatterWriteContext)

寫入 物件,此物件是由 的 Object 屬性工作表示 context 。

(繼承來源 TextOutputFormatter)
WriteObject(TextWriter, Object)

使用指定的 ,將指定的 valuewriter 寫入為 JSON。

WriteResponseBodyAsync(OutputFormatterWriteContext, Encoding)

寫入回應本文。

WriteResponseBodyAsync(OutputFormatterWriteContext)

寫入回應本文。

(繼承來源 TextOutputFormatter)
WriteResponseHeaders(OutputFormatterWriteContext)

設定 物件上的 HttpResponse 標頭。

(繼承來源 OutputFormatter)

適用於