JsonSerializer.DeserializeAsyncEnumerable 方法

定义

重载

名称 说明
DeserializeAsyncEnumerable<TValue>(PipeReader, JsonTypeInfo<TValue>, Boolean, CancellationToken)

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化 JSON 值的序列。

DeserializeAsyncEnumerable<TValue>(Stream, JsonTypeInfo<TValue>, Boolean, CancellationToken)

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化 JSON 值的序列。

DeserializeAsyncEnumerable<TValue>(Stream, Boolean, JsonSerializerOptions, CancellationToken)

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化 JSON 值的序列。

DeserializeAsyncEnumerable<TValue>(PipeReader, Boolean, JsonSerializerOptions, CancellationToken)

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化 JSON 值的序列。

DeserializeAsyncEnumerable<TValue>(Stream, JsonTypeInfo<TValue>, CancellationToken)

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化根级 JSON 数组的文本。

DeserializeAsyncEnumerable<TValue>(Stream, JsonSerializerOptions, CancellationToken)

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化根级 JSON 数组的文本。

DeserializeAsyncEnumerable<TValue>(PipeReader, JsonTypeInfo<TValue>, CancellationToken)

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化根级 JSON 数组的文本。

DeserializeAsyncEnumerable<TValue>(PipeReader, JsonSerializerOptions, CancellationToken)

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化根级 JSON 数组的文本。

DeserializeAsyncEnumerable<TValue>(PipeReader, JsonTypeInfo<TValue>, Boolean, CancellationToken)

Source:
JsonSerializer.Read.Pipe.cs
Source:
JsonSerializer.Read.Pipe.cs
Source:
JsonSerializer.Read.Pipe.cs

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化 JSON 值的序列。

public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Pipelines.PipeReader utf8Json, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, bool topLevelValues, System.Threading.CancellationToken cancellationToken = default);
static member DeserializeAsyncEnumerable : System.IO.Pipelines.PipeReader * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * bool * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As PipeReader, jsonTypeInfo As JsonTypeInfo(Of TValue), topLevelValues As Boolean, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

类型参数

TValue

要异步反序列化的元素类型。

参数

utf8Json
PipeReader

要分析的 JSON 数据。

jsonTypeInfo
JsonTypeInfo<TValue>

要转换的元素类型的元数据。

topLevelValues
Boolean

是否从顶级 JSON 值序列反序列化。

cancellationToken
CancellationToken

CancellationToken可用于取消读取操作的项。

返回

IAsyncEnumerable<T>提供的 JSON 序列的表示形式。

例外

utf8JsonjsonTypeInfonull.

注解

设置为时topLevelValues,将 PipeReader 视为一系列空格分隔的顶级 JSON 值,并尝试将每个值反序列化为 trueTValue

设置为 /> 时,将 PipeReader 视为 JSON 数组,并尝试将每个元素序列化为

适用于

DeserializeAsyncEnumerable<TValue>(Stream, JsonTypeInfo<TValue>, Boolean, CancellationToken)

Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化 JSON 值的序列。

public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, bool topLevelValues, System.Threading.CancellationToken cancellationToken = default);
static member DeserializeAsyncEnumerable : System.IO.Stream * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * bool * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As Stream, jsonTypeInfo As JsonTypeInfo(Of TValue), topLevelValues As Boolean, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

类型参数

TValue

要异步反序列化的元素类型。

参数

utf8Json
Stream

要分析的 JSON 数据。

jsonTypeInfo
JsonTypeInfo<TValue>

要转换的元素类型的元数据。

topLevelValues
Boolean

是否从顶级 JSON 值序列反序列化。

cancellationToken
CancellationToken

CancellationToken可用于取消读取操作的项。

返回

IAsyncEnumerable<T>提供的 JSON 序列的表示形式。

例外

utf8JsonjsonTypeInfonull.

注解

如果 topLevelValues 设置为 true,请将流视为空格分隔的顶级 JSON 值序列,并尝试将每个值反序列化为 TValue

设置为 /> 时,将流视为 JSON 数组,并尝试将每个元素序列化为

适用于

DeserializeAsyncEnumerable<TValue>(Stream, Boolean, JsonSerializerOptions, CancellationToken)

Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化 JSON 值的序列。

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, bool topLevelValues, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, bool topLevelValues, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member DeserializeAsyncEnumerable : System.IO.Stream * bool * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
static member DeserializeAsyncEnumerable : System.IO.Stream * bool * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As Stream, topLevelValues As Boolean, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

类型参数

TValue

要异步反序列化的元素类型。

参数

utf8Json
Stream

要分析的 JSON 数据。

topLevelValues
Boolean

true 从顶级 JSON 值序列反序列化,或 false 从单个顶级数组反序列化。

options
JsonSerializerOptions

用于控制读取过程中行为的选项。

cancellationToken
CancellationToken

CancellationToken可用于取消读取操作的项。

返回

IAsyncEnumerable<T>提供的 JSON 序列的表示形式。

属性

例外

utf8Jsonnull

注解

如果 topLevelValues 设置为 true,请将流视为空格分隔的顶级 JSON 值序列,并尝试将每个值反序列化为 TValue

设置为 /> 时,将流视为 JSON 数组,并尝试将每个元素序列化为

适用于

DeserializeAsyncEnumerable<TValue>(PipeReader, Boolean, JsonSerializerOptions, CancellationToken)

Source:
JsonSerializer.Read.Pipe.cs
Source:
JsonSerializer.Read.Pipe.cs
Source:
JsonSerializer.Read.Pipe.cs

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化 JSON 值的序列。

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Pipelines.PipeReader utf8Json, bool topLevelValues, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Pipelines.PipeReader utf8Json, bool topLevelValues, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member DeserializeAsyncEnumerable : System.IO.Pipelines.PipeReader * bool * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
static member DeserializeAsyncEnumerable : System.IO.Pipelines.PipeReader * bool * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As PipeReader, topLevelValues As Boolean, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

类型参数

TValue

要异步反序列化的元素类型。

参数

utf8Json
PipeReader

要分析的 JSON 数据。

topLevelValues
Boolean

true 从顶级 JSON 值序列反序列化,或 false 从单个顶级数组反序列化。

options
JsonSerializerOptions

用于控制读取过程中行为的选项。

cancellationToken
CancellationToken

CancellationToken可用于取消读取操作的项。

返回

IAsyncEnumerable<T>提供的 JSON 序列的表示形式。

属性

例外

utf8Jsonnull

注解

设置为时topLevelValues,将 PipeReader 视为一系列空格分隔的顶级 JSON 值,并尝试将每个值反序列化为 trueTValue

设置为 /> 时,将 PipeReader 视为 JSON 数组,并尝试将每个元素序列化为

适用于

DeserializeAsyncEnumerable<TValue>(Stream, JsonTypeInfo<TValue>, CancellationToken)

Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化根级 JSON 数组的文本。

public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member DeserializeAsyncEnumerable : System.IO.Stream * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As Stream, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

类型参数

TValue

要异步反序列化的元素类型。

参数

utf8Json
Stream

要分析的 JSON 数据。

jsonTypeInfo
JsonTypeInfo<TValue>

要转换的元素类型的元数据。

cancellationToken
CancellationToken

CancellationToken可用于取消读取操作的项。

返回

IAsyncEnumerable<T>提供的 JSON 数组的表示形式。

例外

utf8JsonjsonTypeInfonull.

取消令牌已取消。 此异常存储在返回的任务中。

适用于

DeserializeAsyncEnumerable<TValue>(Stream, JsonSerializerOptions, CancellationToken)

Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化根级 JSON 数组的文本。

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member DeserializeAsyncEnumerable : System.IO.Stream * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member DeserializeAsyncEnumerable : System.IO.Stream * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
static member DeserializeAsyncEnumerable : System.IO.Stream * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As Stream, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

类型参数

TValue

要异步反序列化的元素类型。

参数

utf8Json
Stream

要分析的 JSON 数据。

options
JsonSerializerOptions

用于控制读取过程中行为的选项。

cancellationToken
CancellationToken

CancellationToken可用于取消读取操作的项。

返回

IAsyncEnumerable<T>提供的 JSON 数组的表示形式。

属性

例外

utf8Jsonnull

取消令牌已取消。 此异常存储在返回的任务中。

适用于

DeserializeAsyncEnumerable<TValue>(PipeReader, JsonTypeInfo<TValue>, CancellationToken)

Source:
JsonSerializer.Read.Pipe.cs
Source:
JsonSerializer.Read.Pipe.cs
Source:
JsonSerializer.Read.Pipe.cs

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化根级 JSON 数组的文本。

public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Pipelines.PipeReader utf8Json, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member DeserializeAsyncEnumerable : System.IO.Pipelines.PipeReader * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As PipeReader, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

类型参数

TValue

要异步反序列化的元素类型。

参数

utf8Json
PipeReader

要分析的 JSON 数据。

jsonTypeInfo
JsonTypeInfo<TValue>

要转换的元素类型的元数据。

cancellationToken
CancellationToken

CancellationToken可用于取消读取操作的项。

返回

IAsyncEnumerable<T>提供的 JSON 数组的表示形式。

例外

utf8JsonjsonTypeInfonull.

适用于

DeserializeAsyncEnumerable<TValue>(PipeReader, JsonSerializerOptions, CancellationToken)

Source:
JsonSerializer.Read.Pipe.cs
Source:
JsonSerializer.Read.Pipe.cs
Source:
JsonSerializer.Read.Pipe.cs

将 UTF-8 编码的文本包装成 IAsyncEnumerable<T> 可用于以流式处理方式反序列化根级 JSON 数组的文本。

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Pipelines.PipeReader utf8Json, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Pipelines.PipeReader utf8Json, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member DeserializeAsyncEnumerable : System.IO.Pipelines.PipeReader * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
static member DeserializeAsyncEnumerable : System.IO.Pipelines.PipeReader * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As PipeReader, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

类型参数

TValue

要异步反序列化的元素类型。

参数

utf8Json
PipeReader

要分析的 JSON 数据。

options
JsonSerializerOptions

用于控制读取过程中行为的选项。

cancellationToken
CancellationToken

CancellationToken可用于取消读取操作的项。

返回

IAsyncEnumerable<T>提供的 JSON 数组的表示形式。

属性

例外

utf8Jsonnull

适用于