JsonOutputFormatter 类

定义

TextOutputFormatter JSON 内容的 。

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
继承

构造函数

JsonOutputFormatter(JsonSerializerSettings, ArrayPool<Char>)

初始化一个新 JsonOutputFormatter 实例。

属性

PublicSerializerSettings

Newtonsoft.Json.JsonSerializerSettings获取用于配置 的 Newtonsoft.Json.JsonSerializer

SerializerSettings

Newtonsoft.Json.JsonSerializerSettings获取用于配置 的 Newtonsoft.Json.JsonSerializer

SupportedEncodings

获取此 TextOutputFormatter支持的字符编码的可变集合。 编写数据时使用编码。

(继承自 TextOutputFormatter)
SupportedMediaTypes

获取此 OutputFormatter支持的媒体类型元素的可变集合。

(继承自 OutputFormatter)

方法

CanWriteResult(OutputFormatterCanWriteContext)

确定这 IOutputFormatter 是否可以序列化指定类型的对象。

(继承自 OutputFormatter)
CanWriteType(Type)

返回一个值,该值指示此序列化程序是否可以写入给定类型。

(继承自 OutputFormatter)
CreateJsonSerializer()

在序列化期间调用 以 Newtonsoft.Json.JsonSerializer创建 。

CreateJsonWriter(TextWriter)

在序列化期间调用 以 Newtonsoft.Json.JsonWriter创建 。

GetSupportedContentTypes(String, Type)

获取 和 contentType支持的内容类型IOutputFormatterobjectType的筛选列表。

(继承自 OutputFormatter)
SelectCharacterEncoding(OutputFormatterWriteContext)

根据提供的内容类型,确定用于读取或写入 HTTP 实体正文的受支持编码中的最佳 Encoding 类型。

(继承自 TextOutputFormatter)
WriteAsync(OutputFormatterWriteContext)

写入 由 context的 Object 属性表示的对象。

(继承自 TextOutputFormatter)
WriteObject(TextWriter, Object)

使用给定 的 将给定 valuewriter的 写入为 JSON。

WriteResponseBodyAsync(OutputFormatterWriteContext)

写入响应正文。

(继承自 TextOutputFormatter)
WriteResponseBodyAsync(OutputFormatterWriteContext, Encoding)

写入响应正文。

WriteResponseHeaders(OutputFormatterWriteContext)

设置 对象上的 HttpResponse 标头。

(继承自 OutputFormatter)

适用于