JsonSerializer.Deserialize Método

Definição

Sobrecargas

Name Description
Deserialize(Stream, JsonTypeInfo)

Lê o texto codificado em UTF-8 que representa um único valor JSON numa instância especificada pelo jsonTypeInfo. O Stream será lido até ao fim.

Deserialize(Utf8JsonReader, Type, JsonSerializerContext)

Lê um valor JSON (incluindo objetos ou arrays) do leitor fornecido para um returnType.

Deserialize(Utf8JsonReader, Type, JsonSerializerOptions)

Lê um valor JSON (incluindo objetos ou arrays) do leitor fornecido e converte-o numa instância de um tipo especificado.

Deserialize(JsonNode, Type, JsonSerializerContext)

Converte o JsonNode que representa um único valor JSON em um returnType.

Deserialize(JsonNode, Type, JsonSerializerOptions)

Converte o JsonNode que representa um único valor JSON em um returnType.

Deserialize(JsonElement, Type, JsonSerializerContext)

Converte o JsonElement que representa um único valor JSON em um returnType.

Deserialize(JsonElement, Type, JsonSerializerOptions)

Converte o JsonElement que representa um único valor JSON em um returnType.

Deserialize(JsonDocument, Type, JsonSerializerContext)

Converte o JsonDocument que representa um único valor JSON em um returnType.

Deserialize(JsonDocument, Type, JsonSerializerOptions)

Converte o JsonDocument que representa um único valor JSON em um returnType.

Deserialize(String, Type, JsonSerializerOptions)

Analisa o texto que representa um único valor JSON numa instância de um tipo especificado.

Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerContext)

Analisa o texto que representa um único valor JSON num returnType.

Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerOptions)

Analisa o texto que representa um único valor JSON numa instância de um tipo especificado.

Deserialize(String, Type, JsonSerializerContext)

Analisa o texto que representa um único valor JSON num returnType.

Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerOptions)

Analisa o texto codificado em UTF-8 que representa um único valor JSON numa instância de um tipo especificado.

Deserialize(ReadOnlySpan<Byte>, JsonTypeInfo)

Analisa o texto codificado em UTF-8 que representa um único valor JSON numa instância especificada pelo jsonTypeInfoarquivo .

Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerContext)

Analisa o texto codificado em UTF-8 que representa um único valor JSON num returnType.

Deserialize(String, JsonTypeInfo)

Analisa o texto que representa um único valor JSON numa instância especificada pelo jsonTypeInfo.

Deserialize(JsonDocument, JsonTypeInfo)

Converte a JsonDocument representação de um único valor JSON numa instância especificada pelo jsonTypeInfo.

Deserialize(JsonElement, JsonTypeInfo)

Converte a JsonElement representação de um único valor JSON numa instância especificada pelo jsonTypeInfo.

Deserialize(ReadOnlySpan<Char>, JsonTypeInfo)

Analisa o texto que representa um único valor JSON numa instância especificada pelo jsonTypeInfo.

Deserialize(Utf8JsonReader, JsonTypeInfo)

Lê um valor JSON (incluindo objetos ou arrays) do leitor fornecido para uma instância especificada pelo jsonTypeInfo.

Deserialize(Stream, Type, JsonSerializerOptions)

Lê o texto codificado em UTF-8 que representa um único valor JSON num returnType. O Stream será lido até ao fim.

Deserialize(Stream, Type, JsonSerializerContext)

Lê o texto codificado em UTF-8 que representa um único valor JSON num returnType. O Stream será lido até ao fim.

Deserialize(JsonNode, JsonTypeInfo)

Converte a JsonNode representação de um único valor JSON numa instância especificada pelo jsonTypeInfo.

Deserialize<TValue>(JsonDocument, JsonTypeInfo<TValue>)

Converte o JsonDocument que representa um único valor JSON em um TValue.

Deserialize<TValue>(Utf8JsonReader, JsonTypeInfo<TValue>)

Lê um valor JSON (incluindo objetos ou arrays) do leitor fornecido para um TValue.

Deserialize<TValue>(Utf8JsonReader, JsonSerializerOptions)

Lê um valor JSON (incluindo objetos ou arrays) do leitor fornecido para uma instância do tipo especificado por um parâmetro genérico de tipo.

Deserialize<TValue>(JsonNode, JsonTypeInfo<TValue>)

Converte o JsonNode que representa um único valor JSON em um TValue.

Deserialize<TValue>(JsonNode, JsonSerializerOptions)

Converte o JsonNode que representa um único valor JSON em um TValue.

Deserialize<TValue>(JsonElement, JsonTypeInfo<TValue>)

Converte o JsonElement que representa um único valor JSON em um TValue.

Deserialize<TValue>(JsonElement, JsonSerializerOptions)

Converte o JsonElement que representa um único valor JSON em um TValue.

Deserialize<TValue>(JsonDocument, JsonSerializerOptions)

Converte o JsonDocument que representa um único valor JSON em um TValue.

Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)

Analisa o texto codificado em UTF-8 que representa um único valor JSON numa instância do tipo especificado por um parâmetro genérico de tipo.

Deserialize<TValue>(String, JsonSerializerOptions)

Analisa o texto que representa um único valor JSON numa instância do tipo especificado por um parâmetro genérico de tipo.

Deserialize<TValue>(ReadOnlySpan<Char>, JsonTypeInfo<TValue>)

Analisa o texto que representa um único valor JSON num TValue.

Deserialize<TValue>(ReadOnlySpan<Char>, JsonSerializerOptions)

Analisa o texto que representa um único valor JSON numa instância do tipo especificado por um parâmetro genérico de tipo.

Deserialize<TValue>(ReadOnlySpan<Byte>, JsonTypeInfo<TValue>)

Analisa o texto codificado em UTF-8 que representa um único valor JSON num TValue.

Deserialize<TValue>(Stream, JsonTypeInfo<TValue>)

Lê o texto codificado em UTF-8 que representa um único valor JSON num TValue. O Stream será lido até ao fim.

Deserialize<TValue>(Stream, JsonSerializerOptions)

Lê o texto codificado em UTF-8 que representa um único valor JSON num TValue. O Stream será lido até ao fim.

Deserialize<TValue>(String, JsonTypeInfo<TValue>)

Analisa o texto que representa um único valor JSON num TValue.

Deserialize(Stream, JsonTypeInfo)

Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs

Lê o texto codificado em UTF-8 que representa um único valor JSON numa instância especificada pelo jsonTypeInfo. O Stream será lido até ao fim.

public:
 static System::Object ^ Deserialize(System::IO::Stream ^ utf8Json, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static object? Deserialize(System.IO.Stream utf8Json, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member Deserialize : System.IO.Stream * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> obj
Public Function Deserialize (utf8Json As Stream, jsonTypeInfo As JsonTypeInfo) As Object

Parâmetros

utf8Json
Stream

Dados JSON para analisar.

jsonTypeInfo
JsonTypeInfo

Metadados sobre o tipo a converter.

Devoluções

Uma jsonTypeInfo representação do valor JSON.

Exceções

utf8Json ou jsonTypeInfo é null.

O JSON é inválido, ou ainda há dados remanescentes no Stream.

Aplica-se a

Deserialize(Utf8JsonReader, Type, JsonSerializerContext)

Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs

Lê um valor JSON (incluindo objetos ou arrays) do leitor fornecido para um returnType.

public:
 static System::Object ^ Deserialize(System::Text::Json::Utf8JsonReader % reader, Type ^ returnType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static object? Deserialize(ref System.Text.Json.Utf8JsonReader reader, Type returnType, System.Text.Json.Serialization.JsonSerializerContext context);
static member Deserialize : Utf8JsonReader * Type * System.Text.Json.Serialization.JsonSerializerContext -> obj
Public Function Deserialize (ByRef reader As Utf8JsonReader, returnType As Type, context As JsonSerializerContext) As Object

Parâmetros

reader
Utf8JsonReader

O leitor para ler.

returnType
Type

O tipo de objeto a converter e a devolver.

context
JsonSerializerContext

Um fornecedor de metadados para tipos serializáveis.

Devoluções

Uma returnType representação do valor JSON.

Exceções

returnType ou context é null.

O JSON é inválido, returnType não é compatível com o JSON, ou um valor não pode ser lido pelo leitor.

reader está a usar opções não suportadas.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

O GetTypeInfo(Type) método no fornecido context não devolveu um compatível JsonTypeInfo para returnType.

Observações

Se a TokenType propriedade de reader for PropertyName ou None, o leitor será avançado por uma chamada para Read() determinar o início do valor.

Após a conclusão deste método, reader é posicionado no token final no valor JSON. Se uma exceção for lançada, o leitor é reiniciado para o estado em que estava quando o método foi chamado.

Este método faz uma cópia dos dados sobre os quais o leitor agiu, pelo que não há necessidade do chamador de manter a integridade dos dados para além do retorno deste método.

Eles JsonReaderOptions são usados para criar a instância de que Utf8JsonReader têm precedência sobre quando JsonSerializerOptions entram em conflito. Assim, AllowTrailingCommas, MaxDepth, e CommentHandling são usados durante a leitura.

Aplica-se a

Deserialize(Utf8JsonReader, Type, JsonSerializerOptions)

Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs

Lê um valor JSON (incluindo objetos ou arrays) do leitor fornecido e converte-o numa instância de um tipo especificado.

[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 object? Deserialize(ref System.Text.Json.Utf8JsonReader reader, Type returnType, System.Text.Json.JsonSerializerOptions? options = default);
public static object? Deserialize(ref System.Text.Json.Utf8JsonReader reader, Type returnType, System.Text.Json.JsonSerializerOptions? options = 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 object? Deserialize(ref System.Text.Json.Utf8JsonReader reader, Type returnType, System.Text.Json.JsonSerializerOptions? options = default);
public static object Deserialize(ref System.Text.Json.Utf8JsonReader reader, Type returnType, System.Text.Json.JsonSerializerOptions options = 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 Deserialize : Utf8JsonReader * Type * System.Text.Json.JsonSerializerOptions -> obj
static member Deserialize : Utf8JsonReader * Type * System.Text.Json.JsonSerializerOptions -> obj
[<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 Deserialize : Utf8JsonReader * Type * System.Text.Json.JsonSerializerOptions -> obj
Public Function Deserialize (ByRef reader As Utf8JsonReader, returnType As Type, Optional options As JsonSerializerOptions = Nothing) As Object
Public Shared Function Deserialize (ByRef reader As Utf8JsonReader, returnType As Type, Optional options As JsonSerializerOptions = Nothing) As Object

Parâmetros

reader
Utf8JsonReader

O leitor para ler o JSON.

returnType
Type

O tipo de objeto a converter e a devolver.

options
JsonSerializerOptions

Opções para controlar o comportamento do serializador durante a leitura.

Devoluções

Uma returnType representação do valor JSON.

Atributos

Exceções

returnType é null.

O JSON é inválido.

-ou-

returnType não é compatível com o JSON.

-ou-

Um valor não podia ser lido pelo leitor.

reader está a usar opções não suportadas.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

Observações

Se a TokenType propriedade de reader for JsonTokenType.PropertyName ou JsonTokenType.None, o leitor será avançado por uma chamada para Utf8JsonReader.Read() determinar o início do valor.

Após a conclusão deste método, reader será posicionado no token final no valor JSON. Se uma exceção for lançada, o leitor é reiniciado para o estado em que estava quando o método foi chamado.

Este método faz uma cópia dos dados sobre os quais o leitor agiu, pelo que não há necessidade do chamador de manter a integridade dos dados para além do retorno deste método.

Eles JsonReaderOptions são usados para criar a instância de que Utf8JsonReader têm precedência sobre quando JsonSerializerOptions entram em conflito. Assim, JsonReaderOptions.AllowTrailingCommas, JsonReaderOptions.MaxDepth, e JsonReaderOptions.CommentHandling são usados durante a leitura.

Para mais informações, veja Como serializar e desserializar JSON.

Aplica-se a

Deserialize(JsonNode, Type, JsonSerializerContext)

Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs

Converte o JsonNode que representa um único valor JSON em um returnType.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ Deserialize(System::Text::Json::Nodes::JsonNode ^ node, Type ^ returnType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static object? Deserialize(this System.Text.Json.Nodes.JsonNode? node, Type returnType, System.Text.Json.Serialization.JsonSerializerContext context);
static member Deserialize : System.Text.Json.Nodes.JsonNode * Type * System.Text.Json.Serialization.JsonSerializerContext -> obj
<Extension()>
Public Function Deserialize (node As JsonNode, returnType As Type, context As JsonSerializerContext) As Object

Parâmetros

node
JsonNode

O JsonNode para converter.

returnType
Type

O tipo de objeto a converter e a devolver.

context
JsonSerializerContext

Um fornecedor de metadados para tipos serializáveis.

Devoluções

Uma returnType representação do valor JSON.

Exceções

returnType é null.

-ou-

context é null.

O JSON é inválido.

-ou-

returnType não é compatível com o JSON.

-ou-

Restam dados na cadeia para além de um único valor JSON.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

O GetTypeInfo(Type) método fornecido context retorna null para o tipo a converter.

Aplica-se a

Deserialize(JsonNode, Type, JsonSerializerOptions)

Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs

Converte o JsonNode que representa um único valor JSON em um returnType.

[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 object? Deserialize(this System.Text.Json.Nodes.JsonNode? node, Type returnType, System.Text.Json.JsonSerializerOptions? options = 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 object? Deserialize(this System.Text.Json.Nodes.JsonNode? node, Type returnType, System.Text.Json.JsonSerializerOptions? options = default);
public static object? Deserialize(this System.Text.Json.Nodes.JsonNode? node, Type returnType, System.Text.Json.JsonSerializerOptions? options = 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 Deserialize : System.Text.Json.Nodes.JsonNode * Type * System.Text.Json.JsonSerializerOptions -> obj
[<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 Deserialize : System.Text.Json.Nodes.JsonNode * Type * System.Text.Json.JsonSerializerOptions -> obj
static member Deserialize : System.Text.Json.Nodes.JsonNode * Type * System.Text.Json.JsonSerializerOptions -> obj
<Extension()>
Public Function Deserialize (node As JsonNode, returnType As Type, Optional options As JsonSerializerOptions = Nothing) As Object

Parâmetros

node
JsonNode

O JsonNode para converter.

returnType
Type

O tipo de objeto a converter e a devolver.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a análise sintática.

Devoluções

Uma returnType representação do valor JSON.

Atributos

Exceções

returnType não é compatível com o JSON.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

Aplica-se a

Deserialize(JsonElement, Type, JsonSerializerContext)

Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs

Converte o JsonElement que representa um único valor JSON em um returnType.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ Deserialize(System::Text::Json::JsonElement element, Type ^ returnType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static object? Deserialize(this System.Text.Json.JsonElement element, Type returnType, System.Text.Json.Serialization.JsonSerializerContext context);
static member Deserialize : System.Text.Json.JsonElement * Type * System.Text.Json.Serialization.JsonSerializerContext -> obj
<Extension()>
Public Function Deserialize (element As JsonElement, returnType As Type, context As JsonSerializerContext) As Object

Parâmetros

element
JsonElement

O JsonElement para converter.

returnType
Type

O tipo de objeto a converter e a devolver.

context
JsonSerializerContext

Um fornecedor de metadados para tipos serializáveis.

Devoluções

Uma returnType representação do valor JSON.

Exceções

returnType é null.

-ou-

context é null.

O JSON é inválido.

-ou-

returnType não é compatível com o JSON.

-ou-

Restam dados na cadeia para além de um único valor JSON.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

O GetTypeInfo(Type) método fornecido context retorna null para o tipo a converter.

Aplica-se a

Deserialize(JsonElement, Type, JsonSerializerOptions)

Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs

Converte o JsonElement que representa um único valor JSON em um returnType.

[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 object? Deserialize(this System.Text.Json.JsonElement element, Type returnType, System.Text.Json.JsonSerializerOptions? options = 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 object? Deserialize(this System.Text.Json.JsonElement element, Type returnType, System.Text.Json.JsonSerializerOptions? options = default);
public static object? Deserialize(this System.Text.Json.JsonElement element, Type returnType, System.Text.Json.JsonSerializerOptions? options = 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 Deserialize : System.Text.Json.JsonElement * Type * System.Text.Json.JsonSerializerOptions -> obj
[<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 Deserialize : System.Text.Json.JsonElement * Type * System.Text.Json.JsonSerializerOptions -> obj
static member Deserialize : System.Text.Json.JsonElement * Type * System.Text.Json.JsonSerializerOptions -> obj
<Extension()>
Public Function Deserialize (element As JsonElement, returnType As Type, Optional options As JsonSerializerOptions = Nothing) As Object

Parâmetros

element
JsonElement

O JsonElement para converter.

returnType
Type

O tipo de objeto a converter e a devolver.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a análise sintática.

Devoluções

Uma returnType representação do valor JSON.

Atributos

Exceções

returnType é null.

returnType não é compatível com o JSON.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

Aplica-se a

Deserialize(JsonDocument, Type, JsonSerializerContext)

Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs

Converte o JsonDocument que representa um único valor JSON em um returnType.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ Deserialize(System::Text::Json::JsonDocument ^ document, Type ^ returnType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static object? Deserialize(this System.Text.Json.JsonDocument document, Type returnType, System.Text.Json.Serialization.JsonSerializerContext context);
static member Deserialize : System.Text.Json.JsonDocument * Type * System.Text.Json.Serialization.JsonSerializerContext -> obj
<Extension()>
Public Function Deserialize (document As JsonDocument, returnType As Type, context As JsonSerializerContext) As Object

Parâmetros

document
JsonDocument

O JsonDocument para converter.

returnType
Type

O tipo de objeto a converter e a devolver.

context
JsonSerializerContext

Um fornecedor de metadados para tipos serializáveis.

Devoluções

Uma returnType representação do valor JSON.

Exceções

document é null.

-ou-

returnType é null.

-ou-

context é null.

O JSON é inválido.

-ou-

returnType não é compatível com o JSON.

-ou-

Restam dados na cadeia para além de um único valor JSON.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

O GetTypeInfo(Type) método fornecido context retorna null para o tipo a converter.

Aplica-se a

Deserialize(JsonDocument, Type, JsonSerializerOptions)

Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs

Converte o JsonDocument que representa um único valor JSON em um returnType.

[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 object? Deserialize(this System.Text.Json.JsonDocument document, Type returnType, System.Text.Json.JsonSerializerOptions? options = 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 object? Deserialize(this System.Text.Json.JsonDocument document, Type returnType, System.Text.Json.JsonSerializerOptions? options = default);
public static object? Deserialize(this System.Text.Json.JsonDocument document, Type returnType, System.Text.Json.JsonSerializerOptions? options = 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 Deserialize : System.Text.Json.JsonDocument * Type * System.Text.Json.JsonSerializerOptions -> obj
[<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 Deserialize : System.Text.Json.JsonDocument * Type * System.Text.Json.JsonSerializerOptions -> obj
static member Deserialize : System.Text.Json.JsonDocument * Type * System.Text.Json.JsonSerializerOptions -> obj
<Extension()>
Public Function Deserialize (document As JsonDocument, returnType As Type, Optional options As JsonSerializerOptions = Nothing) As Object

Parâmetros

document
JsonDocument

O JsonDocument para converter.

returnType
Type

O tipo de objeto a converter e a devolver.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a análise sintática.

Devoluções

Uma returnType representação do valor JSON.

Atributos

Exceções

document ou returnType é null.

returnType não é compatível com o JSON.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

Aplica-se a

Deserialize(String, Type, JsonSerializerOptions)

Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs

Analisa o texto que representa um único valor JSON numa instância de um tipo especificado.

[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 object? Deserialize(string json, Type returnType, System.Text.Json.JsonSerializerOptions? options = default);
public static object? Deserialize(string json, Type returnType, System.Text.Json.JsonSerializerOptions? options = 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 object? Deserialize(string json, Type returnType, System.Text.Json.JsonSerializerOptions? options = default);
public static object Deserialize(string json, Type returnType, System.Text.Json.JsonSerializerOptions options = 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 Deserialize : string * Type * System.Text.Json.JsonSerializerOptions -> obj
static member Deserialize : string * Type * System.Text.Json.JsonSerializerOptions -> obj
[<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 Deserialize : string * Type * System.Text.Json.JsonSerializerOptions -> obj
Public Function Deserialize (json As String, returnType As Type, Optional options As JsonSerializerOptions = Nothing) As Object
Public Shared Function Deserialize (json As String, returnType As Type, Optional options As JsonSerializerOptions = Nothing) As Object

Parâmetros

json
String

O texto JSON para analisar.

returnType
Type

O tipo de objeto a converter e a devolver.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a análise sintática.

Devoluções

Uma returnType representação do valor JSON.

Atributos

Exceções

json ou returnType é null.

O JSON é inválido.

-ou-

TValue não é compatível com o JSON.

-ou-

Restam dados na cadeia para além de um único valor JSON.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

Observações

Usar a String não é tão eficiente como usar os métodos UTF-8, uma vez que a implementação utiliza nativamente o UTF-8.

Para mais informações, veja Como serializar e desserializar JSON.

Aplica-se a

Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerContext)

Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs

Analisa o texto que representa um único valor JSON num returnType.

public:
 static System::Object ^ Deserialize(ReadOnlySpan<char> json, Type ^ returnType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static object? Deserialize(ReadOnlySpan<char> json, Type returnType, System.Text.Json.Serialization.JsonSerializerContext context);
static member Deserialize : ReadOnlySpan<char> * Type * System.Text.Json.Serialization.JsonSerializerContext -> obj
Public Function Deserialize (json As ReadOnlySpan(Of Char), returnType As Type, context As JsonSerializerContext) As Object

Parâmetros

json
ReadOnlySpan<Char>

Texto JSON para analisar.

returnType
Type

O tipo de objeto a converter e a devolver.

context
JsonSerializerContext

Um fornecedor de metadados para tipos serializáveis.

Devoluções

Uma returnType representação do valor JSON.

Exceções

json ou returnType é null.

-ou-

context é null.

O JSON é inválido.

-ou-

returnType não é compatível com o JSON.

-ou-

Restam dados na cadeia para além de um único valor JSON.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

O GetTypeInfo(Type) método fornecido context retorna null para o tipo a converter.

Observações

Usar a String não é tão eficiente como usar os métodos UTF-8, uma vez que a implementação utiliza nativamente o UTF-8.

Aplica-se a

Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerOptions)

Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs

Analisa o texto que representa um único valor JSON numa instância de um tipo especificado.

[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 object? Deserialize(ReadOnlySpan<char> json, Type returnType, System.Text.Json.JsonSerializerOptions? options = 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 object? Deserialize(ReadOnlySpan<char> json, Type returnType, System.Text.Json.JsonSerializerOptions? options = default);
public static object? Deserialize(ReadOnlySpan<char> json, Type returnType, System.Text.Json.JsonSerializerOptions? options = 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 Deserialize : ReadOnlySpan<char> * Type * System.Text.Json.JsonSerializerOptions -> obj
[<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 Deserialize : ReadOnlySpan<char> * Type * System.Text.Json.JsonSerializerOptions -> obj
static member Deserialize : ReadOnlySpan<char> * Type * System.Text.Json.JsonSerializerOptions -> obj
Public Function Deserialize (json As ReadOnlySpan(Of Char), returnType As Type, Optional options As JsonSerializerOptions = Nothing) As Object

Parâmetros

json
ReadOnlySpan<Char>

O texto JSON para analisar.

returnType
Type

O tipo de objeto a converter e a devolver.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a análise sintática.

Devoluções

Uma returnType representação do valor JSON.

Atributos

Exceções

returnType é null.

O JSON é inválido.

-ou-

returnType não é compatível com o JSON.

-ou-

Há dados remanescentes no intervalo para além de um único valor JSON.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

Observações

Usar um intervalo UTF-16 não é tão eficiente como usar os métodos UTF-8, uma vez que a implementação utiliza nativamente o UTF-8.

Aplica-se a

Deserialize(String, Type, JsonSerializerContext)

Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs

Analisa o texto que representa um único valor JSON num returnType.

public:
 static System::Object ^ Deserialize(System::String ^ json, Type ^ returnType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static object? Deserialize(string json, Type returnType, System.Text.Json.Serialization.JsonSerializerContext context);
static member Deserialize : string * Type * System.Text.Json.Serialization.JsonSerializerContext -> obj
Public Function Deserialize (json As String, returnType As Type, context As JsonSerializerContext) As Object

Parâmetros

json
String

Texto JSON para analisar.

returnType
Type

O tipo de objeto a converter e a devolver.

context
JsonSerializerContext

Um fornecedor de metadados para tipos serializáveis.

Devoluções

Uma returnType representação do valor JSON.

Exceções

json ou returnType é null.

-ou-

context é null.

O JSON é inválido.

-ou-

returnType não é compatível com o JSON.

-ou-

Restam dados na cadeia para além de um único valor JSON.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

O GetTypeInfo(Type) método fornecido context retorna null para o tipo a converter.

Observações

Usar a String não é tão eficiente como usar os métodos UTF-8, uma vez que a implementação utiliza nativamente o UTF-8.

Aplica-se a

Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerOptions)

Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs

Analisa o texto codificado em UTF-8 que representa um único valor JSON numa instância de um tipo especificado.

[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 object? Deserialize(ReadOnlySpan<byte> utf8Json, Type returnType, System.Text.Json.JsonSerializerOptions? options = default);
public static object? Deserialize(ReadOnlySpan<byte> utf8Json, Type returnType, System.Text.Json.JsonSerializerOptions? options = 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 object? Deserialize(ReadOnlySpan<byte> utf8Json, Type returnType, System.Text.Json.JsonSerializerOptions? options = default);
public static object Deserialize(ReadOnlySpan<byte> utf8Json, Type returnType, System.Text.Json.JsonSerializerOptions options = 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 Deserialize : ReadOnlySpan<byte> * Type * System.Text.Json.JsonSerializerOptions -> obj
static member Deserialize : ReadOnlySpan<byte> * Type * System.Text.Json.JsonSerializerOptions -> obj
[<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 Deserialize : ReadOnlySpan<byte> * Type * System.Text.Json.JsonSerializerOptions -> obj
Public Function Deserialize (utf8Json As ReadOnlySpan(Of Byte), returnType As Type, Optional options As JsonSerializerOptions = Nothing) As Object
Public Shared Function Deserialize (utf8Json As ReadOnlySpan(Of Byte), returnType As Type, Optional options As JsonSerializerOptions = Nothing) As Object

Parâmetros

utf8Json
ReadOnlySpan<Byte>

O texto JSON para analisar.

returnType
Type

O tipo de objeto a converter e a devolver.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a análise sintática.

Devoluções

Uma returnType representação do valor JSON.

Atributos

Exceções

returnType é null.

O JSON é inválido.

-ou-

returnType não é compatível com o JSON.

-ou-

Há dados remanescentes no intervalo para além de um único valor JSON.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

Observações

Para mais informações, veja Como serializar e desserializar JSON.

Aplica-se a

Deserialize(ReadOnlySpan<Byte>, JsonTypeInfo)

Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs

Analisa o texto codificado em UTF-8 que representa um único valor JSON numa instância especificada pelo jsonTypeInfoarquivo .

public:
 static System::Object ^ Deserialize(ReadOnlySpan<System::Byte> utf8Json, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static object? Deserialize(ReadOnlySpan<byte> utf8Json, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member Deserialize : ReadOnlySpan<byte> * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> obj
Public Function Deserialize (utf8Json As ReadOnlySpan(Of Byte), jsonTypeInfo As JsonTypeInfo) As Object

Parâmetros

utf8Json
ReadOnlySpan<Byte>

Texto JSON para analisar.

jsonTypeInfo
JsonTypeInfo

Metadados sobre o tipo a converter.

Devoluções

Uma jsonTypeInfo representação do valor JSON.

Exceções

O JSON é inválido, ou restam dados no buffer.

Aplica-se a

Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerContext)

Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs

Analisa o texto codificado em UTF-8 que representa um único valor JSON num returnType.

public:
 static System::Object ^ Deserialize(ReadOnlySpan<System::Byte> utf8Json, Type ^ returnType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static object? Deserialize(ReadOnlySpan<byte> utf8Json, Type returnType, System.Text.Json.Serialization.JsonSerializerContext context);
static member Deserialize : ReadOnlySpan<byte> * Type * System.Text.Json.Serialization.JsonSerializerContext -> obj
Public Function Deserialize (utf8Json As ReadOnlySpan(Of Byte), returnType As Type, context As JsonSerializerContext) As Object

Parâmetros

utf8Json
ReadOnlySpan<Byte>

Texto JSON para analisar.

returnType
Type

O tipo de objeto a converter e a devolver.

context
JsonSerializerContext

Um fornecedor de metadados para tipos serializáveis.

Devoluções

Uma returnType representação do valor JSON.

Exceções

returnType é null.

O JSON é inválido, returnType não é compatível com o JSON, ou ainda há dados remanescentes no Stream.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

O GetTypeInfo(Type) método no fornecido context não devolveu um compatível JsonTypeInfo para returnType.

Aplica-se a

Deserialize(String, JsonTypeInfo)

Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs

Analisa o texto que representa um único valor JSON numa instância especificada pelo jsonTypeInfo.

public:
 static System::Object ^ Deserialize(System::String ^ json, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static object? Deserialize(string json, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member Deserialize : string * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> obj
Public Function Deserialize (json As String, jsonTypeInfo As JsonTypeInfo) As Object

Parâmetros

json
String

Texto JSON para analisar.

jsonTypeInfo
JsonTypeInfo

Metadados sobre o tipo a converter.

Devoluções

Uma jsonTypeInfo representação do valor JSON.

Exceções

json é null.

-ou-

jsonTypeInfo é null.

O JSON é inválido.

-ou-

Restam dados na cadeia para além de um único valor JSON.

Observações

Usar a String não é tão eficiente como usar os métodos UTF-8, uma vez que a implementação utiliza nativamente o UTF-8.

Aplica-se a

Deserialize(JsonDocument, JsonTypeInfo)

Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs

Converte a JsonDocument representação de um único valor JSON numa instância especificada pelo jsonTypeInfo.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ Deserialize(System::Text::Json::JsonDocument ^ document, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static object? Deserialize(this System.Text.Json.JsonDocument document, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member Deserialize : System.Text.Json.JsonDocument * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> obj
<Extension()>
Public Function Deserialize (document As JsonDocument, jsonTypeInfo As JsonTypeInfo) As Object

Parâmetros

document
JsonDocument

O JsonDocument para converter.

jsonTypeInfo
JsonTypeInfo

Metadados sobre o tipo a converter.

Devoluções

Uma jsonTypeInfo representação do valor JSON.

Exceções

document é null.

-ou-

jsonTypeInfo é null.

Aplica-se a

Deserialize(JsonElement, JsonTypeInfo)

Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs

Converte a JsonElement representação de um único valor JSON numa instância especificada pelo jsonTypeInfo.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ Deserialize(System::Text::Json::JsonElement element, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static object? Deserialize(this System.Text.Json.JsonElement element, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member Deserialize : System.Text.Json.JsonElement * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> obj
<Extension()>
Public Function Deserialize (element As JsonElement, jsonTypeInfo As JsonTypeInfo) As Object

Parâmetros

element
JsonElement

O JsonElement para converter.

jsonTypeInfo
JsonTypeInfo

Metadados sobre o tipo a converter.

Devoluções

Uma jsonTypeInfo representação do valor JSON.

Exceções

jsonTypeInfo é null.

Aplica-se a

Deserialize(ReadOnlySpan<Char>, JsonTypeInfo)

Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs

Analisa o texto que representa um único valor JSON numa instância especificada pelo jsonTypeInfo.

public:
 static System::Object ^ Deserialize(ReadOnlySpan<char> json, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static object? Deserialize(ReadOnlySpan<char> json, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member Deserialize : ReadOnlySpan<char> * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> obj
Public Function Deserialize (json As ReadOnlySpan(Of Char), jsonTypeInfo As JsonTypeInfo) As Object

Parâmetros

json
ReadOnlySpan<Char>

Texto JSON para analisar.

jsonTypeInfo
JsonTypeInfo

Metadados sobre o tipo a converter.

Devoluções

Uma jsonTypeInfo representação do valor JSON.

Exceções

jsonTypeInfo é null.

O JSON é inválido.

-ou-

Restam dados na cadeia para além de um único valor JSON.

Observações

Usar a String não é tão eficiente como usar os métodos UTF-8, uma vez que a implementação utiliza nativamente o UTF-8.

Aplica-se a

Deserialize(Utf8JsonReader, JsonTypeInfo)

Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs

Lê um valor JSON (incluindo objetos ou arrays) do leitor fornecido para uma instância especificada pelo jsonTypeInfo.

public:
 static System::Object ^ Deserialize(System::Text::Json::Utf8JsonReader % reader, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static object? Deserialize(ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member Deserialize : Utf8JsonReader * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> obj
Public Function Deserialize (ByRef reader As Utf8JsonReader, jsonTypeInfo As JsonTypeInfo) As Object

Parâmetros

reader
Utf8JsonReader

O leitor para ler.

jsonTypeInfo
JsonTypeInfo

Metadados sobre o tipo a converter.

Devoluções

Uma jsonTypeInfo representação do valor JSON.

Exceções

O JSON é inválido, jsonTypeInfo não é compatível com o JSON, ou um valor não pode ser lido pelo leitor.

reader está a usar opções não suportadas.

Observações

Se a TokenType propriedade de reader for PropertyName ou None, o leitor será avançado por uma chamada para Read() determinar o início do valor.

Após a conclusão deste método, reader será posicionado no token final no valor JSON. Se uma exceção for lançada, o leitor é reiniciado para o estado em que estava quando o método foi chamado.

Este método faz uma cópia dos dados sobre os quais o leitor agiu, pelo que não há necessidade do chamador de manter a integridade dos dados para além do retorno deste método.

Eles JsonReaderOptions são usados para criar a instância de que Utf8JsonReader têm precedência sobre quando JsonSerializerOptions entram em conflito. Assim, AllowTrailingCommas, MaxDepth, e CommentHandling são usados durante a leitura.

Aplica-se a

Deserialize(Stream, Type, JsonSerializerOptions)

Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs

Lê o texto codificado em UTF-8 que representa um único valor JSON num returnType. O Stream será lido até ao fim.

[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 object? Deserialize(System.IO.Stream utf8Json, Type returnType, System.Text.Json.JsonSerializerOptions? options = 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 object? Deserialize(System.IO.Stream utf8Json, Type returnType, System.Text.Json.JsonSerializerOptions? options = default);
public static object? Deserialize(System.IO.Stream utf8Json, Type returnType, System.Text.Json.JsonSerializerOptions? options = 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 Deserialize : System.IO.Stream * Type * System.Text.Json.JsonSerializerOptions -> obj
[<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 Deserialize : System.IO.Stream * Type * System.Text.Json.JsonSerializerOptions -> obj
static member Deserialize : System.IO.Stream * Type * System.Text.Json.JsonSerializerOptions -> obj
Public Function Deserialize (utf8Json As Stream, returnType As Type, Optional options As JsonSerializerOptions = Nothing) As Object

Parâmetros

utf8Json
Stream

Dados JSON para analisar.

returnType
Type

O tipo de objeto a converter e a devolver.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a leitura.

Devoluções

Uma returnType representação do valor JSON.

Atributos

Exceções

utf8Json ou returnType é null.

O JSON é inválido, não returnType é compatível com o JSON, ou ainda há dados no Stream.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

Aplica-se a

Deserialize(Stream, Type, JsonSerializerContext)

Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs

Lê o texto codificado em UTF-8 que representa um único valor JSON num returnType. O Stream será lido até ao fim.

public:
 static System::Object ^ Deserialize(System::IO::Stream ^ utf8Json, Type ^ returnType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static object? Deserialize(System.IO.Stream utf8Json, Type returnType, System.Text.Json.Serialization.JsonSerializerContext context);
static member Deserialize : System.IO.Stream * Type * System.Text.Json.Serialization.JsonSerializerContext -> obj
Public Function Deserialize (utf8Json As Stream, returnType As Type, context As JsonSerializerContext) As Object

Parâmetros

utf8Json
Stream

Dados JSON para analisar.

returnType
Type

O tipo de objeto a converter e a devolver.

context
JsonSerializerContext

Um fornecedor de metadados para tipos serializáveis.

Devoluções

Uma returnType representação do valor JSON.

Exceções

utf8Json, returnType, ou context é null.

O JSON é inválido, não returnType é compatível com o JSON, ou ainda há dados no Stream.

Não há membros compatíveis JsonConverter para returnType nem serializáveis.

O GetTypeInfo(Type) método no fornecido context não devolveu um compatível JsonTypeInfo para returnType.

Aplica-se a

Deserialize(JsonNode, JsonTypeInfo)

Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs

Converte a JsonNode representação de um único valor JSON numa instância especificada pelo jsonTypeInfo.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ Deserialize(System::Text::Json::Nodes::JsonNode ^ node, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static object? Deserialize(this System.Text.Json.Nodes.JsonNode? node, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member Deserialize : System.Text.Json.Nodes.JsonNode * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> obj
<Extension()>
Public Function Deserialize (node As JsonNode, jsonTypeInfo As JsonTypeInfo) As Object

Parâmetros

node
JsonNode

O JsonNode para converter.

jsonTypeInfo
JsonTypeInfo

Metadados sobre o tipo a converter.

Devoluções

Uma jsonTypeInfo representação do valor JSON.

Exceções

jsonTypeInfo é null.

Aplica-se a

Deserialize<TValue>(JsonDocument, JsonTypeInfo<TValue>)

Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs

Converte o JsonDocument que representa um único valor JSON em um TValue.

public:
generic <typename TValue>
[System::Runtime::CompilerServices::Extension]
 static TValue Deserialize(System::Text::Json::JsonDocument ^ document, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static TValue? Deserialize<TValue>(this System.Text.Json.JsonDocument document, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member Deserialize : System.Text.Json.JsonDocument * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> 'Value
<Extension()>
Public Function Deserialize(Of TValue) (document As JsonDocument, jsonTypeInfo As JsonTypeInfo(Of TValue)) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo para desserializar o valor JSON.

Parâmetros

document
JsonDocument

O JsonDocument para converter.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadados sobre o tipo a converter.

Devoluções

TValue

Uma TValue representação do valor JSON.

Exceções

document é null.

-ou-

jsonTypeInfo é null.

TValue não é compatível com o JSON.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Aplica-se a

Deserialize<TValue>(Utf8JsonReader, JsonTypeInfo<TValue>)

Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs

Lê um valor JSON (incluindo objetos ou arrays) do leitor fornecido para um TValue.

public:
generic <typename TValue>
 static TValue Deserialize(System::Text::Json::Utf8JsonReader % reader, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static TValue? Deserialize<TValue>(ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member Deserialize : Utf8JsonReader * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> 'Value
Public Function Deserialize(Of TValue) (ByRef reader As Utf8JsonReader, jsonTypeInfo As JsonTypeInfo(Of TValue)) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo para desserializar o valor JSON.

Parâmetros

reader
Utf8JsonReader

O leitor para ler.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadados sobre o tipo a converter.

Devoluções

TValue

Uma TValue representação do valor JSON.

Exceções

O JSON é inválido, TValue não é compatível com o JSON, ou um valor não pode ser lido pelo leitor.

reader está a usar opções não suportadas.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Observações

Se a TokenType propriedade de reader for PropertyName ou None, o leitor será avançado por uma chamada para Read() determinar o início do valor.

Após a conclusão deste método, reader é posicionado no token final no valor JSON. Se uma exceção for lançada, o leitor é reiniciado para o estado em que estava quando o método foi chamado.

Este método faz uma cópia dos dados sobre os quais o leitor agiu, pelo que não há necessidade do chamador de manter a integridade dos dados para além do retorno deste método.

Eles JsonReaderOptions são usados para criar a instância de que Utf8JsonReader têm precedência sobre quando JsonSerializerOptions entram em conflito. Assim, AllowTrailingCommas, MaxDepth, e CommentHandling são usados durante a leitura.

Aplica-se a

Deserialize<TValue>(Utf8JsonReader, JsonSerializerOptions)

Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs
Origem:
JsonSerializer.Read.Utf8JsonReader.cs

Lê um valor JSON (incluindo objetos ou arrays) do leitor fornecido para uma instância do tipo especificado por um parâmetro genérico de tipo.

[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 TValue? Deserialize<TValue>(ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.JsonSerializerOptions? options = default);
public static TValue? Deserialize<TValue>(ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.JsonSerializerOptions? options = 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 TValue? Deserialize<TValue>(ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.JsonSerializerOptions? options = default);
public static TValue Deserialize<TValue>(ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.JsonSerializerOptions options = 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 Deserialize : Utf8JsonReader * System.Text.Json.JsonSerializerOptions -> 'Value
static member Deserialize : Utf8JsonReader * System.Text.Json.JsonSerializerOptions -> '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 Deserialize : Utf8JsonReader * System.Text.Json.JsonSerializerOptions -> 'Value
Public Function Deserialize(Of TValue) (ByRef reader As Utf8JsonReader, Optional options As JsonSerializerOptions = Nothing) As TValue
Public Shared Function Deserialize(Of TValue) (ByRef reader As Utf8JsonReader, Optional options As JsonSerializerOptions = Nothing) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo-alvo do valor JSON.

Parâmetros

reader
Utf8JsonReader

O leitor para ler o JSON.

options
JsonSerializerOptions

Opções para controlar o comportamento do serializador durante a leitura.

Devoluções

TValue

Uma TValue representação do valor JSON.

Atributos

Exceções

O JSON é inválido.

-ou-

TValue não é compatível com o JSON.

-ou-

Um valor não podia ser lido pelo leitor.

reader Usa opções não suportadas.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Observações

Se a TokenType propriedade de reader for JsonTokenType.PropertyName ou JsonTokenType.None, o leitor será avançado por uma chamada para Utf8JsonReader.Read() determinar o início do valor.

Após a conclusão deste método, reader será posicionado no token final no valor JSON. Se uma exceção for lançada, o leitor é reiniciado para o estado em que estava quando o método foi chamado.

Este método faz uma cópia dos dados sobre os quais o leitor agiu, pelo que não há necessidade do chamador de manter a integridade dos dados para além do retorno deste método.

Eles JsonReaderOptions são usados para criar a instância de que Utf8JsonReader têm precedência sobre quando JsonSerializerOptions entram em conflito. Assim, JsonReaderOptions.AllowTrailingCommas, JsonReaderOptions.MaxDepth, e JsonReaderOptions.CommentHandling são usados durante a leitura.

Para mais informações, veja Como serializar e desserializar JSON.

Aplica-se a

Deserialize<TValue>(JsonNode, JsonTypeInfo<TValue>)

Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs

Converte o JsonNode que representa um único valor JSON em um TValue.

public:
generic <typename TValue>
[System::Runtime::CompilerServices::Extension]
 static TValue Deserialize(System::Text::Json::Nodes::JsonNode ^ node, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static TValue? Deserialize<TValue>(this System.Text.Json.Nodes.JsonNode? node, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member Deserialize : System.Text.Json.Nodes.JsonNode * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> 'Value
<Extension()>
Public Function Deserialize(Of TValue) (node As JsonNode, jsonTypeInfo As JsonTypeInfo(Of TValue)) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo para desserializar o valor JSON.

Parâmetros

node
JsonNode

O JsonNode para converter.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadados sobre o tipo a converter.

Devoluções

TValue

Uma TValue representação do valor JSON.

Exceções

jsonTypeInfo é null.

TValue não é compatível com o JSON.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Aplica-se a

Deserialize<TValue>(JsonNode, JsonSerializerOptions)

Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs
Origem:
JsonSerializer.Read.Node.cs

Converte o JsonNode que representa um único valor JSON em um TValue.

[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 TValue? Deserialize<TValue>(this System.Text.Json.Nodes.JsonNode? node, System.Text.Json.JsonSerializerOptions? options = 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 TValue? Deserialize<TValue>(this System.Text.Json.Nodes.JsonNode? node, System.Text.Json.JsonSerializerOptions? options = default);
public static TValue? Deserialize<TValue>(this System.Text.Json.Nodes.JsonNode? node, System.Text.Json.JsonSerializerOptions? options = 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 Deserialize : System.Text.Json.Nodes.JsonNode * System.Text.Json.JsonSerializerOptions -> '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 Deserialize : System.Text.Json.Nodes.JsonNode * System.Text.Json.JsonSerializerOptions -> 'Value
static member Deserialize : System.Text.Json.Nodes.JsonNode * System.Text.Json.JsonSerializerOptions -> 'Value
<Extension()>
Public Function Deserialize(Of TValue) (node As JsonNode, Optional options As JsonSerializerOptions = Nothing) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo para desserializar o valor JSON.

Parâmetros

node
JsonNode

O JsonNode para converter.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a análise sintática.

Devoluções

TValue

Uma TValue representação do valor JSON.

Atributos

Exceções

TValue não é compatível com o JSON.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Aplica-se a

Deserialize<TValue>(JsonElement, JsonTypeInfo<TValue>)

Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs

Converte o JsonElement que representa um único valor JSON em um TValue.

public:
generic <typename TValue>
[System::Runtime::CompilerServices::Extension]
 static TValue Deserialize(System::Text::Json::JsonElement element, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static TValue? Deserialize<TValue>(this System.Text.Json.JsonElement element, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member Deserialize : System.Text.Json.JsonElement * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> 'Value
<Extension()>
Public Function Deserialize(Of TValue) (element As JsonElement, jsonTypeInfo As JsonTypeInfo(Of TValue)) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo para desserializar o valor JSON.

Parâmetros

element
JsonElement

O JsonElement para converter.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadados sobre o tipo a converter.

Devoluções

TValue

Uma TValue representação do valor JSON.

Exceções

jsonTypeInfo é null.

TValue não é compatível com o JSON.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Aplica-se a

Deserialize<TValue>(JsonElement, JsonSerializerOptions)

Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs
Origem:
JsonSerializer.Read.Element.cs

Converte o JsonElement que representa um único valor JSON em um TValue.

[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 TValue? Deserialize<TValue>(this System.Text.Json.JsonElement element, System.Text.Json.JsonSerializerOptions? options = 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 TValue? Deserialize<TValue>(this System.Text.Json.JsonElement element, System.Text.Json.JsonSerializerOptions? options = default);
public static TValue? Deserialize<TValue>(this System.Text.Json.JsonElement element, System.Text.Json.JsonSerializerOptions? options = 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 Deserialize : System.Text.Json.JsonElement * System.Text.Json.JsonSerializerOptions -> '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 Deserialize : System.Text.Json.JsonElement * System.Text.Json.JsonSerializerOptions -> 'Value
static member Deserialize : System.Text.Json.JsonElement * System.Text.Json.JsonSerializerOptions -> 'Value
<Extension()>
Public Function Deserialize(Of TValue) (element As JsonElement, Optional options As JsonSerializerOptions = Nothing) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo para desserializar o valor JSON.

Parâmetros

element
JsonElement

O JsonElement para converter.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a análise sintática.

Devoluções

TValue

Uma TValue representação do valor JSON.

Atributos

Exceções

TValue não é compatível com o JSON.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Aplica-se a

Deserialize<TValue>(JsonDocument, JsonSerializerOptions)

Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs
Origem:
JsonSerializer.Read.Document.cs

Converte o JsonDocument que representa um único valor JSON em um TValue.

[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 TValue? Deserialize<TValue>(this System.Text.Json.JsonDocument document, System.Text.Json.JsonSerializerOptions? options = 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 TValue? Deserialize<TValue>(this System.Text.Json.JsonDocument document, System.Text.Json.JsonSerializerOptions? options = default);
public static TValue? Deserialize<TValue>(this System.Text.Json.JsonDocument document, System.Text.Json.JsonSerializerOptions? options = 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 Deserialize : System.Text.Json.JsonDocument * System.Text.Json.JsonSerializerOptions -> '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 Deserialize : System.Text.Json.JsonDocument * System.Text.Json.JsonSerializerOptions -> 'Value
static member Deserialize : System.Text.Json.JsonDocument * System.Text.Json.JsonSerializerOptions -> 'Value
<Extension()>
Public Function Deserialize(Of TValue) (document As JsonDocument, Optional options As JsonSerializerOptions = Nothing) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo para desserializar o valor JSON.

Parâmetros

document
JsonDocument

O JsonDocument para converter.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a análise sintática.

Devoluções

TValue

Uma TValue representação do valor JSON.

Atributos

Exceções

document é null.

TValue não é compatível com o JSON.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Aplica-se a

Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)

Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs

Analisa o texto codificado em UTF-8 que representa um único valor JSON numa instância do tipo especificado por um parâmetro genérico de tipo.

[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 TValue? Deserialize<TValue>(ReadOnlySpan<byte> utf8Json, System.Text.Json.JsonSerializerOptions? options = default);
public static TValue? Deserialize<TValue>(ReadOnlySpan<byte> utf8Json, System.Text.Json.JsonSerializerOptions? options = 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 TValue? Deserialize<TValue>(ReadOnlySpan<byte> utf8Json, System.Text.Json.JsonSerializerOptions? options = default);
public static TValue Deserialize<TValue>(ReadOnlySpan<byte> utf8Json, System.Text.Json.JsonSerializerOptions options = 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 Deserialize : ReadOnlySpan<byte> * System.Text.Json.JsonSerializerOptions -> 'Value
static member Deserialize : ReadOnlySpan<byte> * System.Text.Json.JsonSerializerOptions -> '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 Deserialize : ReadOnlySpan<byte> * System.Text.Json.JsonSerializerOptions -> 'Value
Public Function Deserialize(Of TValue) (utf8Json As ReadOnlySpan(Of Byte), Optional options As JsonSerializerOptions = Nothing) As TValue
Public Shared Function Deserialize(Of TValue) (utf8Json As ReadOnlySpan(Of Byte), Optional options As JsonSerializerOptions = Nothing) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo alvo do texto codificado UTF-8.

Parâmetros

utf8Json
ReadOnlySpan<Byte>

O texto JSON para analisar.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a análise sintática.

Devoluções

TValue

Uma TValue representação do valor JSON.

Atributos

Exceções

O JSON é inválido.

-ou-

TValue não é compatível com o JSON.

-ou-

Há dados remanescentes no intervalo para além de um único valor JSON.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Observações

Para mais informações, veja Como serializar e desserializar JSON.

Aplica-se a

Deserialize<TValue>(String, JsonSerializerOptions)

Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs

Analisa o texto que representa um único valor JSON numa instância do tipo especificado por um parâmetro genérico de tipo.

[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 TValue? Deserialize<TValue>(string json, System.Text.Json.JsonSerializerOptions? options = default);
public static TValue? Deserialize<TValue>(string json, System.Text.Json.JsonSerializerOptions? options = 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 TValue? Deserialize<TValue>(string json, System.Text.Json.JsonSerializerOptions? options = default);
public static TValue Deserialize<TValue>(string json, System.Text.Json.JsonSerializerOptions options = 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 Deserialize : string * System.Text.Json.JsonSerializerOptions -> 'Value
static member Deserialize : string * System.Text.Json.JsonSerializerOptions -> '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 Deserialize : string * System.Text.Json.JsonSerializerOptions -> 'Value
Public Function Deserialize(Of TValue) (json As String, Optional options As JsonSerializerOptions = Nothing) As TValue
Public Shared Function Deserialize(Of TValue) (json As String, Optional options As JsonSerializerOptions = Nothing) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo-alvo do valor JSON.

Parâmetros

json
String

O texto JSON para analisar.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a análise sintática.

Devoluções

TValue

Uma TValue representação do valor JSON.

Atributos

Exceções

json é null.

O JSON é inválido.

-ou-

TValue não é compatível com o JSON.

-ou-

Restam dados na cadeia para além de um único valor JSON.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Observações

Usar a String não é tão eficiente como usar os métodos UTF-8, uma vez que a implementação utiliza nativamente o UTF-8.

Para mais informações, veja Como serializar e desserializar JSON.

Aplica-se a

Deserialize<TValue>(ReadOnlySpan<Char>, JsonTypeInfo<TValue>)

Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs

Analisa o texto que representa um único valor JSON num TValue.

public:
generic <typename TValue>
 static TValue Deserialize(ReadOnlySpan<char> json, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static TValue? Deserialize<TValue>(ReadOnlySpan<char> json, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member Deserialize : ReadOnlySpan<char> * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> 'Value
Public Function Deserialize(Of TValue) (json As ReadOnlySpan(Of Char), jsonTypeInfo As JsonTypeInfo(Of TValue)) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo para desserializar o valor JSON.

Parâmetros

json
ReadOnlySpan<Char>

Texto JSON para analisar.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadados sobre o tipo a converter.

Devoluções

TValue

Uma TValue representação do valor JSON.

Exceções

json é null.

-ou-

jsonTypeInfo é null.

O JSON é inválido.

-ou-

TValue não é compatível com o JSON.

-ou-

Restam dados na cadeia para além de um único valor JSON.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Observações

Usar a String não é tão eficiente como usar os métodos UTF-8, uma vez que a implementação utiliza nativamente o UTF-8.

Aplica-se a

Deserialize<TValue>(ReadOnlySpan<Char>, JsonSerializerOptions)

Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs

Analisa o texto que representa um único valor JSON numa instância do tipo especificado por um parâmetro genérico de tipo.

[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 TValue? Deserialize<TValue>(ReadOnlySpan<char> json, System.Text.Json.JsonSerializerOptions? options = 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 TValue? Deserialize<TValue>(ReadOnlySpan<char> json, System.Text.Json.JsonSerializerOptions? options = default);
public static TValue? Deserialize<TValue>(ReadOnlySpan<char> json, System.Text.Json.JsonSerializerOptions? options = 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 Deserialize : ReadOnlySpan<char> * System.Text.Json.JsonSerializerOptions -> '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 Deserialize : ReadOnlySpan<char> * System.Text.Json.JsonSerializerOptions -> 'Value
static member Deserialize : ReadOnlySpan<char> * System.Text.Json.JsonSerializerOptions -> 'Value
Public Function Deserialize(Of TValue) (json As ReadOnlySpan(Of Char), Optional options As JsonSerializerOptions = Nothing) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo para desserializar o valor JSON.

Parâmetros

json
ReadOnlySpan<Char>

O texto JSON para analisar.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a análise sintática.

Devoluções

TValue

Uma TValue representação do valor JSON.

Atributos

Exceções

O JSON é inválido.

-ou-

TValue não é compatível com o JSON.

-ou-

Há dados remanescentes no intervalo para além de um único valor JSON.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Observações

Usar um intervalo UTF-16 não é tão eficiente como usar os métodos UTF-8, uma vez que a implementação utiliza nativamente o UTF-8.

Aplica-se a

Deserialize<TValue>(ReadOnlySpan<Byte>, JsonTypeInfo<TValue>)

Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs
Origem:
JsonSerializer.Read.Span.cs

Analisa o texto codificado em UTF-8 que representa um único valor JSON num TValue.

public:
generic <typename TValue>
 static TValue Deserialize(ReadOnlySpan<System::Byte> utf8Json, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static TValue? Deserialize<TValue>(ReadOnlySpan<byte> utf8Json, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member Deserialize : ReadOnlySpan<byte> * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> 'Value
Public Function Deserialize(Of TValue) (utf8Json As ReadOnlySpan(Of Byte), jsonTypeInfo As JsonTypeInfo(Of TValue)) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo para desserializar o valor JSON.

Parâmetros

utf8Json
ReadOnlySpan<Byte>

Texto JSON para analisar.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadados sobre o tipo a converter.

Devoluções

TValue

Uma TValue representação do valor JSON.

Exceções

O JSON é inválido, TValue não é compatível com o JSON, ou ainda há dados remanescentes no Stream.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Aplica-se a

Deserialize<TValue>(Stream, JsonTypeInfo<TValue>)

Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs

Lê o texto codificado em UTF-8 que representa um único valor JSON num TValue. O Stream será lido até ao fim.

public:
generic <typename TValue>
 static TValue Deserialize(System::IO::Stream ^ utf8Json, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static TValue? Deserialize<TValue>(System.IO.Stream utf8Json, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member Deserialize : System.IO.Stream * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> 'Value
Public Function Deserialize(Of TValue) (utf8Json As Stream, jsonTypeInfo As JsonTypeInfo(Of TValue)) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo para desserializar o valor JSON.

Parâmetros

utf8Json
Stream

Dados JSON para analisar.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadados sobre o tipo a converter.

Devoluções

TValue

Uma TValue representação do valor JSON.

Exceções

utf8Json ou jsonTypeInfo é null.

O JSON é inválido, TValue não é compatível com o JSON, ou ainda há dados remanescentes no Stream.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Aplica-se a

Deserialize<TValue>(Stream, JsonSerializerOptions)

Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs
Origem:
JsonSerializer.Read.Stream.cs

Lê o texto codificado em UTF-8 que representa um único valor JSON num TValue. O Stream será lido até ao fim.

[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 TValue? Deserialize<TValue>(System.IO.Stream utf8Json, System.Text.Json.JsonSerializerOptions? options = 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 TValue? Deserialize<TValue>(System.IO.Stream utf8Json, System.Text.Json.JsonSerializerOptions? options = default);
public static TValue? Deserialize<TValue>(System.IO.Stream utf8Json, System.Text.Json.JsonSerializerOptions? options = 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 Deserialize : System.IO.Stream * System.Text.Json.JsonSerializerOptions -> '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 Deserialize : System.IO.Stream * System.Text.Json.JsonSerializerOptions -> 'Value
static member Deserialize : System.IO.Stream * System.Text.Json.JsonSerializerOptions -> 'Value
Public Function Deserialize(Of TValue) (utf8Json As Stream, Optional options As JsonSerializerOptions = Nothing) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo para desserializar o valor JSON.

Parâmetros

utf8Json
Stream

Dados JSON para analisar.

options
JsonSerializerOptions

Opções para controlar o comportamento durante a leitura.

Devoluções

TValue

Uma TValue representação do valor JSON.

Atributos

Exceções

utf8Json é null.

O JSON é inválido, TValue não é compatível com o JSON, ou ainda há dados remanescentes no Stream.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Aplica-se a

Deserialize<TValue>(String, JsonTypeInfo<TValue>)

Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs
Origem:
JsonSerializer.Read.String.cs

Analisa o texto que representa um único valor JSON num TValue.

public:
generic <typename TValue>
 static TValue Deserialize(System::String ^ json, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static TValue? Deserialize<TValue>(string json, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member Deserialize : string * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> 'Value
Public Function Deserialize(Of TValue) (json As String, jsonTypeInfo As JsonTypeInfo(Of TValue)) As TValue

Parâmetros de Tipo Genérico

TValue

O tipo para desserializar o valor JSON.

Parâmetros

json
String

Texto JSON para analisar.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadados sobre o tipo a converter.

Devoluções

TValue

Uma TValue representação do valor JSON.

Exceções

json é null.

-ou-

jsonTypeInfo é null.

O JSON é inválido.

-ou-

TValue não é compatível com o JSON.

-ou-

Restam dados na cadeia para além de um único valor JSON.

Não há membros compatíveis JsonConverter para TValue nem serializáveis.

Observações

Usar a String não é tão eficiente como usar os métodos UTF-8, uma vez que a implementação utiliza nativamente o UTF-8.

Aplica-se a