JsonSerializer.Deserialize Metod

Definition

Överlagringar

Name Description
Deserialize(Stream, JsonTypeInfo)

Läser den UTF-8-kodade texten som representerar ett enda JSON-värde i en instans som anges av jsonTypeInfo. Strömmen kommer att läsas för slutförande.

Deserialize(Utf8JsonReader, Type, JsonSerializerContext)

Läser ett JSON-värde (inklusive objekt eller matriser) från den angivna läsaren till en returnType.

Deserialize(Utf8JsonReader, Type, JsonSerializerOptions)

Läser ett JSON-värde (inklusive objekt eller matriser) från den angivna läsaren och konverterar det till en instans av en angiven typ.

Deserialize(JsonNode, Type, JsonSerializerContext)

Konverterar JsonNode representerar ett enda JSON-värde till en returnType.

Deserialize(JsonNode, Type, JsonSerializerOptions)

Konverterar JsonNode representerar ett enda JSON-värde till en returnType.

Deserialize(JsonElement, Type, JsonSerializerContext)

Konverterar JsonElement representerar ett enda JSON-värde till en returnType.

Deserialize(JsonElement, Type, JsonSerializerOptions)

Konverterar JsonElement representerar ett enda JSON-värde till en returnType.

Deserialize(JsonDocument, Type, JsonSerializerContext)

Konverterar JsonDocument representerar ett enda JSON-värde till en returnType.

Deserialize(JsonDocument, Type, JsonSerializerOptions)

Konverterar JsonDocument representerar ett enda JSON-värde till en returnType.

Deserialize(String, Type, JsonSerializerOptions)

Parsar texten som representerar ett enda JSON-värde i en instans av en angiven typ.

Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerContext)

Parsar texten som representerar ett enda JSON-värde till en returnType.

Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerOptions)

Parsar texten som representerar ett enda JSON-värde i en instans av en angiven typ.

Deserialize(String, Type, JsonSerializerContext)

Parsar texten som representerar ett enda JSON-värde till en returnType.

Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerOptions)

Parsar UTF-8-kodad text som representerar ett enda JSON-värde i en instans av en angiven typ.

Deserialize(ReadOnlySpan<Byte>, JsonTypeInfo)

Parsar UTF-8-kodad text som representerar ett enda JSON-värde i en instans som anges av jsonTypeInfo.

Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerContext)

Parsar UTF-8-kodad text som representerar ett enda JSON-värde i en returnType.

Deserialize(String, JsonTypeInfo)

Parsar texten som representerar ett enda JSON-värde i en instans som anges av jsonTypeInfo.

Deserialize(JsonDocument, JsonTypeInfo)

Konverterar JsonDocument representerar ett enda JSON-värde till en instans som anges av jsonTypeInfo.

Deserialize(JsonElement, JsonTypeInfo)

Konverterar JsonElement representerar ett enda JSON-värde till en instans som anges av jsonTypeInfo.

Deserialize(ReadOnlySpan<Char>, JsonTypeInfo)

Parsar texten som representerar ett enda JSON-värde i en instans som anges av jsonTypeInfo.

Deserialize(Utf8JsonReader, JsonTypeInfo)

Läser ett JSON-värde (inklusive objekt eller matriser) från den angivna läsaren till en instans som anges av jsonTypeInfo.

Deserialize(Stream, Type, JsonSerializerOptions)

Läser den UTF-8-kodade texten som representerar ett enda JSON-värde till en returnType. Strömmen kommer att läsas för slutförande.

Deserialize(Stream, Type, JsonSerializerContext)

Läser den UTF-8-kodade texten som representerar ett enda JSON-värde till en returnType. Strömmen kommer att läsas för slutförande.

Deserialize(JsonNode, JsonTypeInfo)

Konverterar JsonNode representerar ett enda JSON-värde till en instans som anges av jsonTypeInfo.

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

Konverterar JsonDocument representerar ett enda JSON-värde till en TValue.

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

Läser ett JSON-värde (inklusive objekt eller matriser) från den angivna läsaren till en TValue.

Deserialize<TValue>(Utf8JsonReader, JsonSerializerOptions)

Läser ett JSON-värde (inklusive objekt eller matriser) från den angivna läsaren till en instans av den typ som anges av en allmän typparameter.

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

Konverterar JsonNode representerar ett enda JSON-värde till en TValue.

Deserialize<TValue>(JsonNode, JsonSerializerOptions)

Konverterar JsonNode representerar ett enda JSON-värde till en TValue.

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

Konverterar JsonElement representerar ett enda JSON-värde till en TValue.

Deserialize<TValue>(JsonElement, JsonSerializerOptions)

Konverterar JsonElement representerar ett enda JSON-värde till en TValue.

Deserialize<TValue>(JsonDocument, JsonSerializerOptions)

Konverterar JsonDocument representerar ett enda JSON-värde till en TValue.

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

Parsar UTF-8-kodad text som representerar ett enda JSON-värde i en instans av den typ som anges av en allmän typparameter.

Deserialize<TValue>(String, JsonSerializerOptions)

Parsar texten som representerar ett enda JSON-värde i en instans av den typ som anges av en allmän typparameter.

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

Parsar texten som representerar ett enda JSON-värde till en TValue.

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

Parsar texten som representerar ett enda JSON-värde i en instans av den typ som anges av en allmän typparameter.

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

Parsar UTF-8-kodad text som representerar ett enda JSON-värde i en TValue.

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

Läser den UTF-8-kodade texten som representerar ett enda JSON-värde till en TValue. Strömmen kommer att läsas för slutförande.

Deserialize<TValue>(Stream, JsonSerializerOptions)

Läser den UTF-8-kodade texten som representerar ett enda JSON-värde till en TValue. Strömmen kommer att läsas för slutförande.

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

Parsar texten som representerar ett enda JSON-värde till en TValue.

Deserialize(Stream, JsonTypeInfo)

Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs

Läser den UTF-8-kodade texten som representerar ett enda JSON-värde i en instans som anges av jsonTypeInfo. Strömmen kommer att läsas för slutförande.

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

Parametrar

utf8Json
Stream

JSON-data som ska parsas.

jsonTypeInfo
JsonTypeInfo

Metadata om vilken typ som ska konverteras.

Returer

En jsonTypeInfo representation av JSON-värdet.

Undantag

utf8Json eller jsonTypeInfo är null.

JSON är ogiltigt eller så finns det återstående data i Dataströmmen.

Gäller för

Deserialize(Utf8JsonReader, Type, JsonSerializerContext)

Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs

Läser ett JSON-värde (inklusive objekt eller matriser) från den angivna läsaren till en 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

Parametrar

reader
Utf8JsonReader

Läsaren som ska läsas.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

context
JsonSerializerContext

En metadataprovider för serialiserbara typer.

Returer

En returnType representation av JSON-värdet.

Undantag

returnType eller context är null.

JSON är ogiltigt, returnType är inte kompatibelt med JSON eller så gick det inte att läsa ett värde från läsaren.

reader använder alternativ som inte stöds.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Metoden GetTypeInfo(Type) på den angivna context returnerade inte en kompatibel JsonTypeInfo för returnType.

Kommentarer

Om egenskapen TokenTypereader är PropertyName eller None, kommer läsaren att avanceras av ett anrop för att Read() fastställa början av värdet.

När den här metoden reader har slutförts placeras den sista token i JSON-värdet. Om ett undantag utlöses återställs läsaren till det tillstånd den befann sig i när metoden anropades.

Den här metoden gör en kopia av de data som läsaren har agerat på, så det finns inget krav på anroparen att upprätthålla dataintegriteten utöver returen av den här metoden.

Den JsonReaderOptions som används för att skapa instansen Utf8JsonReader av har företräde framför JsonSerializerOptions när de är i konflikt. AllowTrailingCommasDärför används , MaxDepthoch CommentHandling vid läsning.

Gäller för

Deserialize(Utf8JsonReader, Type, JsonSerializerOptions)

Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs

Läser ett JSON-värde (inklusive objekt eller matriser) från den angivna läsaren och konverterar det till en instans av en angiven typ.

[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

Parametrar

reader
Utf8JsonReader

Läsaren att läsa JSON från.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

options
JsonSerializerOptions

Alternativ för att styra serialiserarbeteendet under läsningen.

Returer

En returnType representation av JSON-värdet.

Attribut

Undantag

returnType är null.

JSON är ogiltig.

-eller-

returnType är inte kompatibelt med JSON.

-eller-

Det gick inte att läsa ett värde från läsaren.

reader använder alternativ som inte stöds.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Kommentarer

Om egenskapen TokenTypereader är JsonTokenType.PropertyName eller JsonTokenType.None, kommer läsaren att avanceras av ett anrop för att Utf8JsonReader.Read() fastställa början av värdet.

När den här metoden reader har slutförts placeras den sista token i JSON-värdet. Om ett undantag utlöses återställs läsaren till det tillstånd den befann sig i när metoden anropades.

Den här metoden gör en kopia av de data som läsaren har agerat på, så det finns inget krav på anroparen att upprätthålla dataintegriteten utöver returen av den här metoden.

Den JsonReaderOptions som används för att skapa instansen Utf8JsonReader av har företräde framför JsonSerializerOptions när de är i konflikt. JsonReaderOptions.AllowTrailingCommasDärför används , JsonReaderOptions.MaxDepthoch JsonReaderOptions.CommentHandling vid läsning.

Mer information finns i Serialisera och deserialisera JSON.

Gäller för

Deserialize(JsonNode, Type, JsonSerializerContext)

Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs

Konverterar JsonNode representerar ett enda JSON-värde till en 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

Parametrar

node
JsonNode

Att JsonNode konvertera.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

context
JsonSerializerContext

En metadataprovider för serialiserbara typer.

Returer

En returnType representation av JSON-värdet.

Undantag

returnType är null.

-eller-

context är null.

JSON är ogiltig.

-eller-

returnType är inte kompatibelt med JSON.

-eller-

Det finns återstående data i strängen utöver ett enda JSON-värde.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Metoden GetTypeInfo(Type) för de angivna context returnerar null för den typ som ska konverteras.

Gäller för

Deserialize(JsonNode, Type, JsonSerializerOptions)

Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs

Konverterar JsonNode representerar ett enda JSON-värde till en 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

Parametrar

node
JsonNode

Att JsonNode konvertera.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

options
JsonSerializerOptions

Alternativ för att styra beteendet under parsningen.

Returer

En returnType representation av JSON-värdet.

Attribut

Undantag

returnType är inte kompatibelt med JSON.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Gäller för

Deserialize(JsonElement, Type, JsonSerializerContext)

Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs

Konverterar JsonElement representerar ett enda JSON-värde till en 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

Parametrar

element
JsonElement

Att JsonElement konvertera.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

context
JsonSerializerContext

En metadataprovider för serialiserbara typer.

Returer

En returnType representation av JSON-värdet.

Undantag

returnType är null.

-eller-

context är null.

JSON är ogiltig.

-eller-

returnType är inte kompatibelt med JSON.

-eller-

Det finns återstående data i strängen utöver ett enda JSON-värde.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Metoden GetTypeInfo(Type) för de angivna context returnerar null för den typ som ska konverteras.

Gäller för

Deserialize(JsonElement, Type, JsonSerializerOptions)

Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs

Konverterar JsonElement representerar ett enda JSON-värde till en 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

Parametrar

element
JsonElement

Att JsonElement konvertera.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

options
JsonSerializerOptions

Alternativ för att styra beteendet under parsningen.

Returer

En returnType representation av JSON-värdet.

Attribut

Undantag

returnType är null.

returnType är inte kompatibelt med JSON.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Gäller för

Deserialize(JsonDocument, Type, JsonSerializerContext)

Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs

Konverterar JsonDocument representerar ett enda JSON-värde till en 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

Parametrar

document
JsonDocument

Att JsonDocument konvertera.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

context
JsonSerializerContext

En metadataprovider för serialiserbara typer.

Returer

En returnType representation av JSON-värdet.

Undantag

document är null.

-eller-

returnType är null.

-eller-

context är null.

JSON är ogiltig.

-eller-

returnType är inte kompatibelt med JSON.

-eller-

Det finns återstående data i strängen utöver ett enda JSON-värde.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Metoden GetTypeInfo(Type) för de angivna context returnerar null för den typ som ska konverteras.

Gäller för

Deserialize(JsonDocument, Type, JsonSerializerOptions)

Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs

Konverterar JsonDocument representerar ett enda JSON-värde till en 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

Parametrar

document
JsonDocument

Att JsonDocument konvertera.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

options
JsonSerializerOptions

Alternativ för att styra beteendet under parsningen.

Returer

En returnType representation av JSON-värdet.

Attribut

Undantag

document eller returnType är null.

returnType är inte kompatibelt med JSON.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Gäller för

Deserialize(String, Type, JsonSerializerOptions)

Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs

Parsar texten som representerar ett enda JSON-värde i en instans av en angiven typ.

[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

Parametrar

json
String

JSON-texten som ska parsas.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

options
JsonSerializerOptions

Alternativ för att styra beteendet under parsningen.

Returer

En returnType representation av JSON-värdet.

Attribut

Undantag

json eller returnType är null.

JSON är ogiltig.

-eller-

TValue är inte kompatibelt med JSON.

-eller-

Det finns återstående data i strängen utöver ett enda JSON-värde.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Kommentarer

Att använda en String är inte lika effektivt som att använda UTF-8-metoderna eftersom implementeringen internt använder UTF-8.

Mer information finns i Serialisera och deserialisera JSON.

Gäller för

Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerContext)

Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs

Parsar texten som representerar ett enda JSON-värde till en 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

Parametrar

json
ReadOnlySpan<Char>

JSON-text som ska parsas.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

context
JsonSerializerContext

En metadataprovider för serialiserbara typer.

Returer

En returnType representation av JSON-värdet.

Undantag

json eller returnType är null.

-eller-

context är null.

JSON är ogiltig.

-eller-

returnType är inte kompatibelt med JSON.

-eller-

Det finns återstående data i strängen utöver ett enda JSON-värde.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Metoden GetTypeInfo(Type) för de angivna context returnerar null för den typ som ska konverteras.

Kommentarer

Att använda en String är inte lika effektivt som att använda UTF-8-metoderna eftersom implementeringen internt använder UTF-8.

Gäller för

Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerOptions)

Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs

Parsar texten som representerar ett enda JSON-värde i en instans av en angiven typ.

[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

Parametrar

json
ReadOnlySpan<Char>

JSON-texten som ska parsas.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

options
JsonSerializerOptions

Alternativ för att styra beteendet under parsningen.

Returer

En returnType representation av JSON-värdet.

Attribut

Undantag

returnType är null.

JSON är ogiltig.

-eller-

returnType är inte kompatibelt med JSON.

-eller-

Det finns återstående data i intervallet utöver ett enda JSON-värde.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Kommentarer

Att använda ett UTF-16-intervall är inte lika effektivt som att använda UTF-8-metoderna eftersom implementeringen internt använder UTF-8.

Gäller för

Deserialize(String, Type, JsonSerializerContext)

Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs

Parsar texten som representerar ett enda JSON-värde till en 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

Parametrar

json
String

JSON-text som ska parsas.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

context
JsonSerializerContext

En metadataprovider för serialiserbara typer.

Returer

En returnType representation av JSON-värdet.

Undantag

json eller returnType är null.

-eller-

context är null.

JSON är ogiltig.

-eller-

returnType är inte kompatibelt med JSON.

-eller-

Det finns återstående data i strängen utöver ett enda JSON-värde.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Metoden GetTypeInfo(Type) för de angivna context returnerar null för den typ som ska konverteras.

Kommentarer

Att använda en String är inte lika effektivt som att använda UTF-8-metoderna eftersom implementeringen internt använder UTF-8.

Gäller för

Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerOptions)

Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs

Parsar UTF-8-kodad text som representerar ett enda JSON-värde i en instans av en angiven typ.

[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

Parametrar

utf8Json
ReadOnlySpan<Byte>

JSON-texten som ska parsas.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

options
JsonSerializerOptions

Alternativ för att styra beteendet under parsningen.

Returer

En returnType representation av JSON-värdet.

Attribut

Undantag

returnType är null.

JSON är ogiltig.

-eller-

returnType är inte kompatibelt med JSON.

-eller-

Det finns återstående data i intervallet utöver ett enda JSON-värde.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Kommentarer

Mer information finns i Serialisera och deserialisera JSON.

Gäller för

Deserialize(ReadOnlySpan<Byte>, JsonTypeInfo)

Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs

Parsar UTF-8-kodad text som representerar ett enda JSON-värde i en instans som anges av jsonTypeInfo.

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

Parametrar

utf8Json
ReadOnlySpan<Byte>

JSON-text som ska parsas.

jsonTypeInfo
JsonTypeInfo

Metadata om vilken typ som ska konverteras.

Returer

En jsonTypeInfo representation av JSON-värdet.

Undantag

JSON är ogiltigt eller så finns det återstående data i bufferten.

Gäller för

Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerContext)

Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs

Parsar UTF-8-kodad text som representerar ett enda JSON-värde i en 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

Parametrar

utf8Json
ReadOnlySpan<Byte>

JSON-text som ska parsas.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

context
JsonSerializerContext

En metadataprovider för serialiserbara typer.

Returer

En returnType representation av JSON-värdet.

Undantag

returnType är null.

JSON är ogiltigt, returnType är inte kompatibelt med JSON eller så finns det återstående data i Stream.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Metoden GetTypeInfo(Type) på den angivna context returnerade inte en kompatibel JsonTypeInfo för returnType.

Gäller för

Deserialize(String, JsonTypeInfo)

Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs

Parsar texten som representerar ett enda JSON-värde i en instans som anges av 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

Parametrar

json
String

JSON-text som ska parsas.

jsonTypeInfo
JsonTypeInfo

Metadata om vilken typ som ska konverteras.

Returer

En jsonTypeInfo representation av JSON-värdet.

Undantag

json är null.

-eller-

jsonTypeInfo är null.

JSON är ogiltig.

-eller-

Det finns återstående data i strängen utöver ett enda JSON-värde.

Kommentarer

Att använda en String är inte lika effektivt som att använda UTF-8-metoderna eftersom implementeringen internt använder UTF-8.

Gäller för

Deserialize(JsonDocument, JsonTypeInfo)

Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs

Konverterar JsonDocument representerar ett enda JSON-värde till en instans som anges av 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

Parametrar

document
JsonDocument

Att JsonDocument konvertera.

jsonTypeInfo
JsonTypeInfo

Metadata om vilken typ som ska konverteras.

Returer

En jsonTypeInfo representation av JSON-värdet.

Undantag

document är null.

-eller-

jsonTypeInfo är null.

Gäller för

Deserialize(JsonElement, JsonTypeInfo)

Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs

Konverterar JsonElement representerar ett enda JSON-värde till en instans som anges av 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

Parametrar

element
JsonElement

Att JsonElement konvertera.

jsonTypeInfo
JsonTypeInfo

Metadata om vilken typ som ska konverteras.

Returer

En jsonTypeInfo representation av JSON-värdet.

Undantag

jsonTypeInfo är null.

Gäller för

Deserialize(ReadOnlySpan<Char>, JsonTypeInfo)

Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs

Parsar texten som representerar ett enda JSON-värde i en instans som anges av 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

Parametrar

json
ReadOnlySpan<Char>

JSON-text som ska parsas.

jsonTypeInfo
JsonTypeInfo

Metadata om vilken typ som ska konverteras.

Returer

En jsonTypeInfo representation av JSON-värdet.

Undantag

jsonTypeInfo är null.

JSON är ogiltig.

-eller-

Det finns återstående data i strängen utöver ett enda JSON-värde.

Kommentarer

Att använda en String är inte lika effektivt som att använda UTF-8-metoderna eftersom implementeringen internt använder UTF-8.

Gäller för

Deserialize(Utf8JsonReader, JsonTypeInfo)

Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs

Läser ett JSON-värde (inklusive objekt eller matriser) från den angivna läsaren till en instans som anges av 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

Parametrar

reader
Utf8JsonReader

Läsaren som ska läsas.

jsonTypeInfo
JsonTypeInfo

Metadata om vilken typ som ska konverteras.

Returer

En jsonTypeInfo representation av JSON-värdet.

Undantag

JSON är ogiltigt, jsonTypeInfo är inte kompatibelt med JSON eller så gick det inte att läsa ett värde från läsaren.

reader använder alternativ som inte stöds.

Kommentarer

Om egenskapen TokenTypereader är PropertyName eller None, kommer läsaren att avanceras av ett anrop för att Read() fastställa början av värdet.

När den här metoden reader har slutförts placeras den sista token i JSON-värdet. Om ett undantag utlöses återställs läsaren till det tillstånd den befann sig i när metoden anropades.

Den här metoden gör en kopia av de data som läsaren har agerat på, så det finns inget krav på anroparen att upprätthålla dataintegriteten utöver returen av den här metoden.

Den JsonReaderOptions som används för att skapa instansen Utf8JsonReader av har företräde framför JsonSerializerOptions när de är i konflikt. AllowTrailingCommasDärför används , MaxDepthoch CommentHandling vid läsning.

Gäller för

Deserialize(Stream, Type, JsonSerializerOptions)

Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs

Läser den UTF-8-kodade texten som representerar ett enda JSON-värde till en returnType. Strömmen kommer att läsas för slutförande.

[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

Parametrar

utf8Json
Stream

JSON-data som ska parsas.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

options
JsonSerializerOptions

Alternativ för att styra beteendet under läsningen.

Returer

En returnType representation av JSON-värdet.

Attribut

Undantag

utf8Json eller returnType är null.

JSON är ogiltigt, returnType är inte kompatibelt med JSON eller så finns det återstående data i Stream.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Gäller för

Deserialize(Stream, Type, JsonSerializerContext)

Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs

Läser den UTF-8-kodade texten som representerar ett enda JSON-värde till en returnType. Strömmen kommer att läsas för slutförande.

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

Parametrar

utf8Json
Stream

JSON-data som ska parsas.

returnType
Type

Typen av objekt som ska konverteras till och returneras.

context
JsonSerializerContext

En metadataprovider för serialiserbara typer.

Returer

En returnType representation av JSON-värdet.

Undantag

utf8Json, returnType, eller context är null.

JSON är ogiltigt, returnType är inte kompatibelt med JSON eller så finns det återstående data i Stream.

Det finns inga kompatibla JsonConverter för returnType eller dess serialiserbara medlemmar.

Metoden GetTypeInfo(Type) på den angivna context returnerade inte en kompatibel JsonTypeInfo för returnType.

Gäller för

Deserialize(JsonNode, JsonTypeInfo)

Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs

Konverterar JsonNode representerar ett enda JSON-värde till en instans som anges av 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

Parametrar

node
JsonNode

Att JsonNode konvertera.

jsonTypeInfo
JsonTypeInfo

Metadata om vilken typ som ska konverteras.

Returer

En jsonTypeInfo representation av JSON-värdet.

Undantag

jsonTypeInfo är null.

Gäller för

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

Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs

Konverterar JsonDocument representerar ett enda JSON-värde till en 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

Typparametrar

TValue

Den typ som JSON-värdet ska deserialiseras till.

Parametrar

document
JsonDocument

Att JsonDocument konvertera.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata om vilken typ som ska konverteras.

Returer

TValue

En TValue representation av JSON-värdet.

Undantag

document är null.

-eller-

jsonTypeInfo är null.

TValue är inte kompatibelt med JSON.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Gäller för

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

Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs

Läser ett JSON-värde (inklusive objekt eller matriser) från den angivna läsaren till en 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

Typparametrar

TValue

Den typ som JSON-värdet ska deserialiseras till.

Parametrar

reader
Utf8JsonReader

Läsaren som ska läsas.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata om vilken typ som ska konverteras.

Returer

TValue

En TValue representation av JSON-värdet.

Undantag

JSON är ogiltigt, TValue är inte kompatibelt med JSON eller så gick det inte att läsa ett värde från läsaren.

reader använder alternativ som inte stöds.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Kommentarer

Om egenskapen TokenTypereader är PropertyName eller None, kommer läsaren att avanceras av ett anrop för att Read() fastställa början av värdet.

När den här metoden reader har slutförts placeras den sista token i JSON-värdet. Om ett undantag utlöses återställs läsaren till det tillstånd den befann sig i när metoden anropades.

Den här metoden gör en kopia av de data som läsaren har agerat på, så det finns inget krav på anroparen att upprätthålla dataintegriteten utöver returen av den här metoden.

Den JsonReaderOptions som används för att skapa instansen Utf8JsonReader av har företräde framför JsonSerializerOptions när de är i konflikt. AllowTrailingCommasDärför används , MaxDepthoch CommentHandling vid läsning.

Gäller för

Deserialize<TValue>(Utf8JsonReader, JsonSerializerOptions)

Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs
Källa:
JsonSerializer.Read.Utf8JsonReader.cs

Läser ett JSON-värde (inklusive objekt eller matriser) från den angivna läsaren till en instans av den typ som anges av en allmän typparameter.

[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

Typparametrar

TValue

Måltypen för JSON-värdet.

Parametrar

reader
Utf8JsonReader

Läsaren att läsa JSON från.

options
JsonSerializerOptions

Alternativ för att kontrollera serialiserarbeteendet under läsningen.

Returer

TValue

En TValue representation av JSON-värdet.

Attribut

Undantag

JSON är ogiltig.

-eller-

TValue är inte kompatibelt med JSON.

-eller-

Det gick inte att läsa ett värde från läsaren.

reader använder alternativ som inte stöds.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Kommentarer

Om egenskapen TokenTypereader är JsonTokenType.PropertyName eller JsonTokenType.None, kommer läsaren att avanceras av ett anrop för att Utf8JsonReader.Read() fastställa början av värdet.

När den här metoden reader har slutförts placeras den sista token i JSON-värdet. Om ett undantag utlöses återställs läsaren till det tillstånd den befann sig i när metoden anropades.

Den här metoden gör en kopia av de data som läsaren har agerat på, så det finns inget krav på anroparen att upprätthålla dataintegriteten utöver returen av den här metoden.

Den JsonReaderOptions som används för att skapa instansen Utf8JsonReader av har företräde framför JsonSerializerOptions när de är i konflikt. JsonReaderOptions.AllowTrailingCommasDärför används , JsonReaderOptions.MaxDepthoch JsonReaderOptions.CommentHandling vid läsning.

Mer information finns i Serialisera och deserialisera JSON.

Gäller för

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

Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs

Konverterar JsonNode representerar ett enda JSON-värde till en 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

Typparametrar

TValue

Den typ som JSON-värdet ska deserialiseras till.

Parametrar

node
JsonNode

Att JsonNode konvertera.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata om vilken typ som ska konverteras.

Returer

TValue

En TValue representation av JSON-värdet.

Undantag

jsonTypeInfo är null.

TValue är inte kompatibelt med JSON.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Gäller för

Deserialize<TValue>(JsonNode, JsonSerializerOptions)

Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs
Källa:
JsonSerializer.Read.Node.cs

Konverterar JsonNode representerar ett enda JSON-värde till en 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

Typparametrar

TValue

Den typ som JSON-värdet ska deserialiseras till.

Parametrar

node
JsonNode

Att JsonNode konvertera.

options
JsonSerializerOptions

Alternativ för att styra beteendet under parsningen.

Returer

TValue

En TValue representation av JSON-värdet.

Attribut

Undantag

TValue är inte kompatibelt med JSON.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Gäller för

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

Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs

Konverterar JsonElement representerar ett enda JSON-värde till en 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

Typparametrar

TValue

Den typ som JSON-värdet ska deserialiseras till.

Parametrar

element
JsonElement

Att JsonElement konvertera.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata om vilken typ som ska konverteras.

Returer

TValue

En TValue representation av JSON-värdet.

Undantag

jsonTypeInfo är null.

TValue är inte kompatibelt med JSON.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Gäller för

Deserialize<TValue>(JsonElement, JsonSerializerOptions)

Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs
Källa:
JsonSerializer.Read.Element.cs

Konverterar JsonElement representerar ett enda JSON-värde till en 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

Typparametrar

TValue

Den typ som JSON-värdet ska deserialiseras till.

Parametrar

element
JsonElement

Att JsonElement konvertera.

options
JsonSerializerOptions

Alternativ för att styra beteendet under parsningen.

Returer

TValue

En TValue representation av JSON-värdet.

Attribut

Undantag

TValue är inte kompatibelt med JSON.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Gäller för

Deserialize<TValue>(JsonDocument, JsonSerializerOptions)

Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs
Källa:
JsonSerializer.Read.Document.cs

Konverterar JsonDocument representerar ett enda JSON-värde till en 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

Typparametrar

TValue

Den typ som JSON-värdet ska deserialiseras till.

Parametrar

document
JsonDocument

Att JsonDocument konvertera.

options
JsonSerializerOptions

Alternativ för att styra beteendet under parsningen.

Returer

TValue

En TValue representation av JSON-värdet.

Attribut

Undantag

document är null.

TValue är inte kompatibelt med JSON.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Gäller för

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

Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs

Parsar UTF-8-kodad text som representerar ett enda JSON-värde i en instans av den typ som anges av en allmän typparameter.

[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

Typparametrar

TValue

Måltypen för UTF-8-kodad text.

Parametrar

utf8Json
ReadOnlySpan<Byte>

JSON-texten som ska parsas.

options
JsonSerializerOptions

Alternativ för att styra beteendet under parsningen.

Returer

TValue

En TValue representation av JSON-värdet.

Attribut

Undantag

JSON är ogiltig.

-eller-

TValue är inte kompatibelt med JSON.

-eller-

Det finns återstående data i intervallet utöver ett enda JSON-värde.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Kommentarer

Mer information finns i Serialisera och deserialisera JSON.

Gäller för

Deserialize<TValue>(String, JsonSerializerOptions)

Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs

Parsar texten som representerar ett enda JSON-värde i en instans av den typ som anges av en allmän typparameter.

[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

Typparametrar

TValue

Måltypen för JSON-värdet.

Parametrar

json
String

JSON-texten som ska parsas.

options
JsonSerializerOptions

Alternativ för att styra beteendet under parsningen.

Returer

TValue

En TValue representation av JSON-värdet.

Attribut

Undantag

json är null.

JSON är ogiltig.

-eller-

TValue är inte kompatibelt med JSON.

-eller-

Det finns återstående data i strängen utöver ett enda JSON-värde.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Kommentarer

Att använda en String är inte lika effektivt som att använda UTF-8-metoderna eftersom implementeringen internt använder UTF-8.

Mer information finns i Serialisera och deserialisera JSON.

Gäller för

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

Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs

Parsar texten som representerar ett enda JSON-värde till en 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

Typparametrar

TValue

Den typ som JSON-värdet ska deserialiseras till.

Parametrar

json
ReadOnlySpan<Char>

JSON-text som ska parsas.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata om vilken typ som ska konverteras.

Returer

TValue

En TValue representation av JSON-värdet.

Undantag

json är null.

-eller-

jsonTypeInfo är null.

JSON är ogiltig.

-eller-

TValue är inte kompatibelt med JSON.

-eller-

Det finns återstående data i strängen utöver ett enda JSON-värde.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Kommentarer

Att använda en String är inte lika effektivt som att använda UTF-8-metoderna eftersom implementeringen internt använder UTF-8.

Gäller för

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

Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs

Parsar texten som representerar ett enda JSON-värde i en instans av den typ som anges av en allmän typparameter.

[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

Typparametrar

TValue

Den typ som JSON-värdet ska deserialiseras till.

Parametrar

json
ReadOnlySpan<Char>

JSON-texten som ska parsas.

options
JsonSerializerOptions

Alternativ för att styra beteendet under parsningen.

Returer

TValue

En TValue representation av JSON-värdet.

Attribut

Undantag

JSON är ogiltig.

-eller-

TValue är inte kompatibelt med JSON.

-eller-

Det finns återstående data i intervallet utöver ett enda JSON-värde.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Kommentarer

Att använda ett UTF-16-intervall är inte lika effektivt som att använda UTF-8-metoderna eftersom implementeringen internt använder UTF-8.

Gäller för

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

Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs
Källa:
JsonSerializer.Read.Span.cs

Parsar UTF-8-kodad text som representerar ett enda JSON-värde i en 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

Typparametrar

TValue

Den typ som JSON-värdet ska deserialiseras till.

Parametrar

utf8Json
ReadOnlySpan<Byte>

JSON-text som ska parsas.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata om vilken typ som ska konverteras.

Returer

TValue

En TValue representation av JSON-värdet.

Undantag

JSON är ogiltigt, TValue är inte kompatibelt med JSON eller så finns det återstående data i Stream.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Gäller för

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

Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs

Läser den UTF-8-kodade texten som representerar ett enda JSON-värde till en TValue. Strömmen kommer att läsas för slutförande.

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

Typparametrar

TValue

Den typ som JSON-värdet ska deserialiseras till.

Parametrar

utf8Json
Stream

JSON-data som ska parsas.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata om vilken typ som ska konverteras.

Returer

TValue

En TValue representation av JSON-värdet.

Undantag

utf8Json eller jsonTypeInfo är null.

JSON är ogiltigt, TValue är inte kompatibelt med JSON eller så finns det återstående data i Stream.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Gäller för

Deserialize<TValue>(Stream, JsonSerializerOptions)

Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs
Källa:
JsonSerializer.Read.Stream.cs

Läser den UTF-8-kodade texten som representerar ett enda JSON-värde till en TValue. Strömmen kommer att läsas för slutförande.

[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

Typparametrar

TValue

Den typ som JSON-värdet ska deserialiseras till.

Parametrar

utf8Json
Stream

JSON-data som ska parsas.

options
JsonSerializerOptions

Alternativ för att styra beteendet under läsningen.

Returer

TValue

En TValue representation av JSON-värdet.

Attribut

Undantag

utf8Json är null.

JSON är ogiltigt, TValue är inte kompatibelt med JSON eller så finns det återstående data i Stream.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Gäller för

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

Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs
Källa:
JsonSerializer.Read.String.cs

Parsar texten som representerar ett enda JSON-värde till en 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

Typparametrar

TValue

Den typ som JSON-värdet ska deserialiseras till.

Parametrar

json
String

JSON-text som ska parsas.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata om vilken typ som ska konverteras.

Returer

TValue

En TValue representation av JSON-värdet.

Undantag

json är null.

-eller-

jsonTypeInfo är null.

JSON är ogiltig.

-eller-

TValue är inte kompatibelt med JSON.

-eller-

Det finns återstående data i strängen utöver ett enda JSON-värde.

Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.

Kommentarer

Att använda en String är inte lika effektivt som att använda UTF-8-metoderna eftersom implementeringen internt använder UTF-8.

Gäller för