JsonSerializer.Deserialize Metoda
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Přetížení
| Name | Description |
|---|---|
| Deserialize(Stream, JsonTypeInfo) |
Přečte kódovaný text UTF-8 představující jednu hodnotu JSON do instance určené znakem |
| Deserialize(Utf8JsonReader, Type, JsonSerializerContext) |
Načte jednu hodnotu JSON (včetně objektů nebo polí) ze zadané čtečky do objektu |
| Deserialize(Utf8JsonReader, Type, JsonSerializerOptions) |
Načte jednu hodnotu JSON (včetně objektů nebo polí) ze zadané čtečky a převede ji na instanci zadaného typu. |
| Deserialize(JsonNode, Type, JsonSerializerContext) |
Převede reprezentaci JsonNode jedné hodnoty JSON na |
| Deserialize(JsonNode, Type, JsonSerializerOptions) |
Převede reprezentaci JsonNode jedné hodnoty JSON na |
| Deserialize(JsonElement, Type, JsonSerializerContext) |
Převede reprezentaci JsonElement jedné hodnoty JSON na |
| Deserialize(JsonElement, Type, JsonSerializerOptions) |
Převede reprezentaci JsonElement jedné hodnoty JSON na |
| Deserialize(JsonDocument, Type, JsonSerializerContext) |
Převede reprezentaci JsonDocument jedné hodnoty JSON na |
| Deserialize(JsonDocument, Type, JsonSerializerOptions) |
Převede reprezentaci JsonDocument jedné hodnoty JSON na |
| Deserialize(String, Type, JsonSerializerOptions) |
Parsuje text představující jednu hodnotu JSON do instance zadaného typu. |
| Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerContext) |
Parsuje text představující jednu hodnotu JSON do objektu |
| Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerOptions) |
Parsuje text představující jednu hodnotu JSON do instance zadaného typu. |
| Deserialize(String, Type, JsonSerializerContext) |
Parsuje text představující jednu hodnotu JSON do objektu |
| Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerOptions) |
Parsuje kódovaný text UTF-8 představující jednu hodnotu JSON do instance zadaného typu. |
| Deserialize(ReadOnlySpan<Byte>, JsonTypeInfo) |
Parsuje kódovaný text UTF-8 představující jednu hodnotu JSON do instance určené znakem |
| Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerContext) |
Parsuje kódovaný text UTF-8 představující jednu hodnotu JSON do objektu |
| Deserialize(String, JsonTypeInfo) |
Parsuje text představující jednu hodnotu JSON do instance určené objektem |
| Deserialize(JsonDocument, JsonTypeInfo) |
Převede reprezentaci JsonDocument jedné hodnoty JSON na instanci určenou objektem |
| Deserialize(JsonElement, JsonTypeInfo) |
Převede reprezentaci JsonElement jedné hodnoty JSON na instanci určenou objektem |
| Deserialize(ReadOnlySpan<Char>, JsonTypeInfo) |
Parsuje text představující jednu hodnotu JSON do instance určené objektem |
| Deserialize(Utf8JsonReader, JsonTypeInfo) |
Načte jednu hodnotu JSON (včetně objektů nebo polí) ze zadané čtečky do instance určené objektem |
| Deserialize(Stream, Type, JsonSerializerOptions) |
Přečte kódovaný text UTF-8 představující jednu hodnotu JSON do objektu |
| Deserialize(Stream, Type, JsonSerializerContext) |
Přečte kódovaný text UTF-8 představující jednu hodnotu JSON do objektu |
| Deserialize(JsonNode, JsonTypeInfo) |
Převede reprezentaci JsonNode jedné hodnoty JSON na instanci určenou objektem |
| Deserialize<TValue>(JsonDocument, JsonTypeInfo<TValue>) |
Převede reprezentaci JsonDocument jedné hodnoty JSON na |
| Deserialize<TValue>(Utf8JsonReader, JsonTypeInfo<TValue>) |
Načte jednu hodnotu JSON (včetně objektů nebo polí) ze zadané čtečky do objektu |
| Deserialize<TValue>(Utf8JsonReader, JsonSerializerOptions) |
Načte jednu hodnotu JSON (včetně objektů nebo polí) ze zadané čtečky do instance typu určeného parametrem obecného typu. |
| Deserialize<TValue>(JsonNode, JsonTypeInfo<TValue>) |
Převede reprezentaci JsonNode jedné hodnoty JSON na |
| Deserialize<TValue>(JsonNode, JsonSerializerOptions) |
Převede reprezentaci JsonNode jedné hodnoty JSON na |
| Deserialize<TValue>(JsonElement, JsonTypeInfo<TValue>) |
Převede reprezentaci JsonElement jedné hodnoty JSON na |
| Deserialize<TValue>(JsonElement, JsonSerializerOptions) |
Převede reprezentaci JsonElement jedné hodnoty JSON na |
| Deserialize<TValue>(JsonDocument, JsonSerializerOptions) |
Převede reprezentaci JsonDocument jedné hodnoty JSON na |
| Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions) |
Parsuje kódovaný text UTF-8 představující jednu hodnotu JSON do instance typu určeného parametrem obecného typu. |
| Deserialize<TValue>(String, JsonSerializerOptions) |
Analyzuje text představující jednu hodnotu JSON do instance typu určeného parametrem obecného typu. |
| Deserialize<TValue>(ReadOnlySpan<Char>, JsonTypeInfo<TValue>) |
Parsuje text představující jednu hodnotu JSON do objektu |
| Deserialize<TValue>(ReadOnlySpan<Char>, JsonSerializerOptions) |
Analyzuje text představující jednu hodnotu JSON do instance typu určeného parametrem obecného typu. |
| Deserialize<TValue>(ReadOnlySpan<Byte>, JsonTypeInfo<TValue>) |
Parsuje kódovaný text UTF-8 představující jednu hodnotu JSON do objektu |
| Deserialize<TValue>(Stream, JsonTypeInfo<TValue>) |
Přečte kódovaný text UTF-8 představující jednu hodnotu JSON do objektu |
| Deserialize<TValue>(Stream, JsonSerializerOptions) |
Přečte kódovaný text UTF-8 představující jednu hodnotu JSON do objektu |
| Deserialize<TValue>(String, JsonTypeInfo<TValue>) |
Parsuje text představující jednu hodnotu JSON do objektu |
Deserialize(Stream, JsonTypeInfo)
Přečte kódovaný text UTF-8 představující jednu hodnotu JSON do instance určené znakem jsonTypeInfo.
Stream se přečte do dokončení.
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
Parametry
- utf8Json
- Stream
Data JSON, která se mají analyzovat
- jsonTypeInfo
- JsonTypeInfo
Metadata o typu, který chcete převést.
Návraty
Reprezentace jsonTypeInfo hodnoty JSON.
Výjimky
utf8Json nebo jsonTypeInfo je null.
JSON je neplatný nebo ve streamu jsou zbývající data.
Platí pro
Deserialize(Utf8JsonReader, Type, JsonSerializerContext)
Načte jednu hodnotu JSON (včetně objektů nebo polí) ze zadané čtečky do objektu 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
Parametry
- reader
- Utf8JsonReader
Čtenář, který se má přečíst.
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- context
- JsonSerializerContext
Zprostředkovatel metadat pro serializovatelné typy.
Návraty
Reprezentace returnType hodnoty JSON.
Výjimky
returnType nebo context je null.
Json je neplatný, returnType není kompatibilní s JSON nebo nelze přečíst hodnotu ze čtečky.
reader používá nepodporované možnosti.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Metoda GetTypeInfo(Type) na zadané context straně nevrátila kompatibilní JsonTypeInfo pro returnType.
Poznámky
TokenType Pokud je PropertyName vlastnost reader nebo None, bude čtenář rozšířen jedním voláním k Read() určení začátku hodnoty.
Po dokončení této metody reader se umístí na konečný token v hodnotě JSON. Pokud je vyvolána výjimka, čtenář se resetuje do stavu, ve který byl při zavolání metody.
Tato metoda vytvoří kopii dat, na která čtenář reagoval, takže neexistuje žádný požadavek volajícího na zachování integrity dat nad rámec vrácení této metody.
Použitý JsonReaderOptions k vytvoření instance Utf8JsonReader má přednost před konfliktem JsonSerializerOptions . Proto se AllowTrailingCommasMaxDepthpři čtení používají a CommentHandling používají se.
Platí pro
Deserialize(Utf8JsonReader, Type, JsonSerializerOptions)
Načte jednu hodnotu JSON (včetně objektů nebo polí) ze zadané čtečky a převede ji na instanci zadaného typu.
[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
Parametry
- reader
- Utf8JsonReader
Čtenář čte json ze souboru JSON.
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- options
- JsonSerializerOptions
Možnosti řízení chování serializátoru během čtení
Návraty
Reprezentace returnType hodnoty JSON.
- Atributy
Výjimky
returnType je null.
Json je neplatný.
nebo
returnType není kompatibilní s JSON.
nebo
Hodnotu nelze přečíst ze čtečky.
reader používá nepodporované možnosti.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Poznámky
TokenType Pokud je JsonTokenType.PropertyName vlastnost reader nebo JsonTokenType.None, bude čtenář rozšířen jedním voláním k Utf8JsonReader.Read() určení začátku hodnoty.
Po dokončení této metody reader se umístí na konečný token v hodnotě JSON. Pokud je vyvolána výjimka, čtenář se resetuje do stavu, ve který byl při zavolání metody.
Tato metoda vytvoří kopii dat, na která čtenář reagoval, takže neexistuje žádný požadavek volajícího na zachování integrity dat nad rámec vrácení této metody.
Použitý JsonReaderOptions k vytvoření instance Utf8JsonReader má přednost před konfliktem JsonSerializerOptions . Proto se JsonReaderOptions.AllowTrailingCommasJsonReaderOptions.MaxDepthpři čtení používají a JsonReaderOptions.CommentHandling používají se.
Další informace naleznete v tématu Jak serializovat a deserializovat JSON.
Platí pro
Deserialize(JsonNode, Type, JsonSerializerContext)
Převede reprezentaci JsonNode jedné hodnoty JSON na returnTypehodnotu .
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
Parametry
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- context
- JsonSerializerContext
Zprostředkovatel metadat pro serializovatelné typy.
Návraty
Reprezentace returnType hodnoty JSON.
Výjimky
Json je neplatný.
nebo
returnType není kompatibilní s JSON.
nebo
V řetězci jsou zbývající data nad rámec jedné hodnoty JSON.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Metoda GetTypeInfo(Type) zadaného context návratu null pro typ, který se má převést.
Platí pro
Deserialize(JsonNode, Type, JsonSerializerOptions)
Převede reprezentaci JsonNode jedné hodnoty JSON na returnTypehodnotu .
[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
Parametry
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- options
- JsonSerializerOptions
Možnosti řízení chování při analýze
Návraty
Reprezentace returnType hodnoty JSON.
- Atributy
Výjimky
returnType není kompatibilní s JSON.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Platí pro
Deserialize(JsonElement, Type, JsonSerializerContext)
Převede reprezentaci JsonElement jedné hodnoty JSON na returnTypehodnotu .
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
Parametry
- element
- JsonElement
Převod.JsonElement
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- context
- JsonSerializerContext
Zprostředkovatel metadat pro serializovatelné typy.
Návraty
Reprezentace returnType hodnoty JSON.
Výjimky
Json je neplatný.
nebo
returnType není kompatibilní s JSON.
nebo
V řetězci jsou zbývající data nad rámec jedné hodnoty JSON.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Metoda GetTypeInfo(Type) zadaného context návratu null pro typ, který se má převést.
Platí pro
Deserialize(JsonElement, Type, JsonSerializerOptions)
Převede reprezentaci JsonElement jedné hodnoty JSON na returnTypehodnotu .
[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
Parametry
- element
- JsonElement
Převod.JsonElement
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- options
- JsonSerializerOptions
Možnosti řízení chování při analýze
Návraty
Reprezentace returnType hodnoty JSON.
- Atributy
Výjimky
returnType je null.
returnType není kompatibilní s JSON.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Platí pro
Deserialize(JsonDocument, Type, JsonSerializerContext)
Převede reprezentaci JsonDocument jedné hodnoty JSON na returnTypehodnotu .
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
Parametry
- document
- JsonDocument
Převod.JsonDocument
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- context
- JsonSerializerContext
Zprostředkovatel metadat pro serializovatelné typy.
Návraty
Reprezentace returnType hodnoty JSON.
Výjimky
Json je neplatný.
nebo
returnType není kompatibilní s JSON.
nebo
V řetězci jsou zbývající data nad rámec jedné hodnoty JSON.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Metoda GetTypeInfo(Type) zadaného context návratu null pro typ, který se má převést.
Platí pro
Deserialize(JsonDocument, Type, JsonSerializerOptions)
Převede reprezentaci JsonDocument jedné hodnoty JSON na returnTypehodnotu .
[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
Parametry
- document
- JsonDocument
Převod.JsonDocument
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- options
- JsonSerializerOptions
Možnosti řízení chování při analýze
Návraty
Reprezentace returnType hodnoty JSON.
- Atributy
Výjimky
document nebo returnType je null.
returnType není kompatibilní s JSON.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Platí pro
Deserialize(String, Type, JsonSerializerOptions)
Parsuje text představující jednu hodnotu JSON do instance zadaného typu.
[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
Parametry
- json
- String
Text JSON, který se má analyzovat.
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- options
- JsonSerializerOptions
Možnosti řízení chování při analýze
Návraty
Reprezentace returnType hodnoty JSON.
- Atributy
Výjimky
json nebo returnType je null.
Json je neplatný.
nebo
TValue není kompatibilní s JSON.
nebo
V řetězci jsou zbývající data nad rámec jedné hodnoty JSON.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Poznámky
String Použití metody UTF-8 není tak efektivní, protože implementace nativně používá UTF-8.
Další informace naleznete v tématu Jak serializovat a deserializovat JSON.
Platí pro
Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerContext)
Parsuje text představující jednu hodnotu JSON do objektu 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
Parametry
- json
- ReadOnlySpan<Char>
Text JSON, který se má analyzovat
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- context
- JsonSerializerContext
Zprostředkovatel metadat pro serializovatelné typy.
Návraty
Reprezentace returnType hodnoty JSON.
Výjimky
Json je neplatný.
nebo
returnType není kompatibilní s JSON.
nebo
V řetězci jsou zbývající data nad rámec jedné hodnoty JSON.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Metoda GetTypeInfo(Type) zadaného context návratu null pro typ, který se má převést.
Poznámky
String Použití metody UTF-8 není tak efektivní, protože implementace nativně používá UTF-8.
Platí pro
Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerOptions)
Parsuje text představující jednu hodnotu JSON do instance zadaného typu.
[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
Parametry
- json
- ReadOnlySpan<Char>
Text JSON, který se má analyzovat.
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- options
- JsonSerializerOptions
Možnosti řízení chování při analýze
Návraty
Reprezentace returnType hodnoty JSON.
- Atributy
Výjimky
returnType je null.
Json je neplatný.
nebo
returnType není kompatibilní s JSON.
nebo
Zbývající data jsou v rozsahu nad rámec jedné hodnoty JSON.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Poznámky
Použití rozsahu UTF-16 není tak efektivní jako použití metod UTF-8, protože implementace nativně používá UTF-8.
Platí pro
Deserialize(String, Type, JsonSerializerContext)
Parsuje text představující jednu hodnotu JSON do objektu 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
Parametry
- json
- String
Text JSON, který se má analyzovat
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- context
- JsonSerializerContext
Zprostředkovatel metadat pro serializovatelné typy.
Návraty
Reprezentace returnType hodnoty JSON.
Výjimky
Json je neplatný.
nebo
returnType není kompatibilní s JSON.
nebo
V řetězci jsou zbývající data nad rámec jedné hodnoty JSON.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Metoda GetTypeInfo(Type) zadaného context návratu null pro typ, který se má převést.
Poznámky
String Použití metody UTF-8 není tak efektivní, protože implementace nativně používá UTF-8.
Platí pro
Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerOptions)
Parsuje kódovaný text UTF-8 představující jednu hodnotu JSON do instance zadaného typu.
[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
Parametry
- utf8Json
- ReadOnlySpan<Byte>
Text JSON, který se má analyzovat.
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- options
- JsonSerializerOptions
Možnosti řízení chování při analýze
Návraty
Reprezentace returnType hodnoty JSON.
- Atributy
Výjimky
returnType je null.
Json je neplatný.
nebo
returnType není kompatibilní s JSON.
nebo
Zbývající data jsou v rozsahu nad rámec jedné hodnoty JSON.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Poznámky
Další informace naleznete v tématu Jak serializovat a deserializovat JSON.
Platí pro
Deserialize(ReadOnlySpan<Byte>, JsonTypeInfo)
Parsuje kódovaný text UTF-8 představující jednu hodnotu JSON do instance určené znakem 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
Parametry
- utf8Json
- ReadOnlySpan<Byte>
Text JSON, který se má analyzovat
- jsonTypeInfo
- JsonTypeInfo
Metadata o typu, který chcete převést.
Návraty
Reprezentace jsonTypeInfo hodnoty JSON.
Výjimky
JSON je neplatný nebo ve vyrovnávací paměti jsou zbývající data.
Platí pro
Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerContext)
Parsuje kódovaný text UTF-8 představující jednu hodnotu JSON do objektu 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
Parametry
- utf8Json
- ReadOnlySpan<Byte>
Text JSON, který se má analyzovat
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- context
- JsonSerializerContext
Zprostředkovatel metadat pro serializovatelné typy.
Návraty
Reprezentace returnType hodnoty JSON.
Výjimky
returnType je null.
JSON je neplatný, returnType není kompatibilní s JSON nebo ve streamu jsou zbývající data.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Metoda GetTypeInfo(Type) na zadané context straně nevrátila kompatibilní JsonTypeInfo pro returnType.
Platí pro
Deserialize(String, JsonTypeInfo)
Parsuje text představující jednu hodnotu JSON do instance určené objektem 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
Parametry
- json
- String
Text JSON, který se má analyzovat
- jsonTypeInfo
- JsonTypeInfo
Metadata o typu, který chcete převést.
Návraty
Reprezentace jsonTypeInfo hodnoty JSON.
Výjimky
Poznámky
String Použití metody UTF-8 není tak efektivní, protože implementace nativně používá UTF-8.
Platí pro
Deserialize(JsonDocument, JsonTypeInfo)
Převede reprezentaci JsonDocument jedné hodnoty JSON na instanci určenou objektem 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
Parametry
- document
- JsonDocument
Převod.JsonDocument
- jsonTypeInfo
- JsonTypeInfo
Metadata o typu, který chcete převést.
Návraty
Reprezentace jsonTypeInfo hodnoty JSON.
Výjimky
Platí pro
Deserialize(JsonElement, JsonTypeInfo)
Převede reprezentaci JsonElement jedné hodnoty JSON na instanci určenou objektem 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
Parametry
- element
- JsonElement
Převod.JsonElement
- jsonTypeInfo
- JsonTypeInfo
Metadata o typu, který chcete převést.
Návraty
Reprezentace jsonTypeInfo hodnoty JSON.
Výjimky
jsonTypeInfo je null.
Platí pro
Deserialize(ReadOnlySpan<Char>, JsonTypeInfo)
Parsuje text představující jednu hodnotu JSON do instance určené objektem 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
Parametry
- json
- ReadOnlySpan<Char>
Text JSON, který se má analyzovat
- jsonTypeInfo
- JsonTypeInfo
Metadata o typu, který chcete převést.
Návraty
Reprezentace jsonTypeInfo hodnoty JSON.
Výjimky
jsonTypeInfo je null.
Poznámky
String Použití metody UTF-8 není tak efektivní, protože implementace nativně používá UTF-8.
Platí pro
Deserialize(Utf8JsonReader, JsonTypeInfo)
Načte jednu hodnotu JSON (včetně objektů nebo polí) ze zadané čtečky do instance určené objektem 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
Parametry
- reader
- Utf8JsonReader
Čtenář, který se má přečíst.
- jsonTypeInfo
- JsonTypeInfo
Metadata o typu, který chcete převést.
Návraty
Reprezentace jsonTypeInfo hodnoty JSON.
Výjimky
Json je neplatný, jsonTypeInfo není kompatibilní s JSON nebo nelze přečíst hodnotu ze čtečky.
reader používá nepodporované možnosti.
Poznámky
TokenType Pokud je PropertyName vlastnost reader nebo None, bude čtenář rozšířen jedním voláním k Read() určení začátku hodnoty.
Po dokončení této metody reader se umístí na konečný token v hodnotě JSON. Pokud je vyvolána výjimka, čtenář se resetuje do stavu, ve který byl při zavolání metody.
Tato metoda vytvoří kopii dat, na která čtenář reagoval, takže neexistuje žádný požadavek volajícího na zachování integrity dat nad rámec vrácení této metody.
Použitý JsonReaderOptions k vytvoření instance Utf8JsonReader má přednost před konfliktem JsonSerializerOptions . Proto se AllowTrailingCommasMaxDepthpři čtení používají a CommentHandling používají se.
Platí pro
Deserialize(Stream, Type, JsonSerializerOptions)
Přečte kódovaný text UTF-8 představující jednu hodnotu JSON do objektu returnType.
Stream se přečte do dokončení.
[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
Parametry
- utf8Json
- Stream
Data JSON, která se mají analyzovat
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- options
- JsonSerializerOptions
Možnosti řízení chování při čtení
Návraty
Reprezentace returnType hodnoty JSON.
- Atributy
Výjimky
utf8Json nebo returnType je null.
JSON je neplatný, returnType není kompatibilní s JSON nebo ve streamu jsou zbývající data.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Platí pro
Deserialize(Stream, Type, JsonSerializerContext)
Přečte kódovaný text UTF-8 představující jednu hodnotu JSON do objektu returnType.
Stream se přečte do dokončení.
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
Parametry
- utf8Json
- Stream
Data JSON, která se mají analyzovat
- returnType
- Type
Typ objektu, na který se má převést a vrátit.
- context
- JsonSerializerContext
Zprostředkovatel metadat pro serializovatelné typy.
Návraty
Reprezentace returnType hodnoty JSON.
Výjimky
utf8Json, returnTypenebo context je null.
JSON je neplatný, returnType není kompatibilní s JSON nebo ve streamu jsou zbývající data.
Pro serializovatelné členy není kompatibilní JsonConverterreturnType .
Metoda GetTypeInfo(Type) na zadané context straně nevrátila kompatibilní JsonTypeInfo pro returnType.
Platí pro
Deserialize(JsonNode, JsonTypeInfo)
Převede reprezentaci JsonNode jedné hodnoty JSON na instanci určenou objektem 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
Parametry
- jsonTypeInfo
- JsonTypeInfo
Metadata o typu, který chcete převést.
Návraty
Reprezentace jsonTypeInfo hodnoty JSON.
Výjimky
jsonTypeInfo je null.
Platí pro
Deserialize<TValue>(JsonDocument, JsonTypeInfo<TValue>)
Převede reprezentaci JsonDocument jedné hodnoty JSON na TValuehodnotu .
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
Parametry typu
- TValue
Typ pro deserializaci hodnoty JSON do.
Parametry
- document
- JsonDocument
Převod.JsonDocument
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metadata o typu, který chcete převést.
Návraty
Reprezentace TValue hodnoty JSON.
Výjimky
TValue není kompatibilní s JSON.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Platí pro
Deserialize<TValue>(Utf8JsonReader, JsonTypeInfo<TValue>)
Načte jednu hodnotu JSON (včetně objektů nebo polí) ze zadané čtečky do objektu 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
Parametry typu
- TValue
Typ pro deserializaci hodnoty JSON do.
Parametry
- reader
- Utf8JsonReader
Čtenář, který se má přečíst.
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metadata o typu, který chcete převést.
Návraty
Reprezentace TValue hodnoty JSON.
Výjimky
Json je neplatný, TValue není kompatibilní s JSON nebo nelze přečíst hodnotu ze čtečky.
reader používá nepodporované možnosti.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Poznámky
TokenType Pokud je PropertyName vlastnost reader nebo None, bude čtenář rozšířen jedním voláním k Read() určení začátku hodnoty.
Po dokončení této metody reader se umístí na konečný token v hodnotě JSON. Pokud je vyvolána výjimka, čtenář se resetuje do stavu, ve který byl při zavolání metody.
Tato metoda vytvoří kopii dat, na která čtenář reagoval, takže neexistuje žádný požadavek volajícího na zachování integrity dat nad rámec vrácení této metody.
Použitý JsonReaderOptions k vytvoření instance Utf8JsonReader má přednost před konfliktem JsonSerializerOptions . Proto se AllowTrailingCommasMaxDepthpři čtení používají a CommentHandling používají se.
Platí pro
Deserialize<TValue>(Utf8JsonReader, JsonSerializerOptions)
Načte jednu hodnotu JSON (včetně objektů nebo polí) ze zadané čtečky do instance typu určeného parametrem obecného typu.
[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
Parametry typu
- TValue
Cílový typ hodnoty JSON.
Parametry
- reader
- Utf8JsonReader
Čtenář čte json ze souboru JSON.
- options
- JsonSerializerOptions
Možnosti řízení chování serializátoru během čtení
Návraty
Reprezentace TValue hodnoty JSON.
- Atributy
Výjimky
Json je neplatný.
nebo
TValue není kompatibilní s JSON.
nebo
Hodnotu nelze přečíst ze čtečky.
reader používá nepodporované možnosti.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Poznámky
TokenType Pokud je JsonTokenType.PropertyName vlastnost reader nebo JsonTokenType.None, bude čtenář rozšířen jedním voláním k Utf8JsonReader.Read() určení začátku hodnoty.
Po dokončení této metody reader se umístí na konečný token v hodnotě JSON. Pokud je vyvolána výjimka, čtenář se resetuje do stavu, ve který byl při zavolání metody.
Tato metoda vytvoří kopii dat, na která čtenář reagoval, takže neexistuje žádný požadavek volajícího na zachování integrity dat nad rámec vrácení této metody.
Použitý JsonReaderOptions k vytvoření instance Utf8JsonReader má přednost před konfliktem JsonSerializerOptions . Proto se JsonReaderOptions.AllowTrailingCommasJsonReaderOptions.MaxDepthpři čtení používají a JsonReaderOptions.CommentHandling používají se.
Další informace naleznete v tématu Jak serializovat a deserializovat JSON.
Platí pro
Deserialize<TValue>(JsonNode, JsonTypeInfo<TValue>)
Převede reprezentaci JsonNode jedné hodnoty JSON na TValuehodnotu .
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
Parametry typu
- TValue
Typ pro deserializaci hodnoty JSON do.
Parametry
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metadata o typu, který chcete převést.
Návraty
Reprezentace TValue hodnoty JSON.
Výjimky
jsonTypeInfo je null.
TValue není kompatibilní s JSON.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Platí pro
Deserialize<TValue>(JsonNode, JsonSerializerOptions)
Převede reprezentaci JsonNode jedné hodnoty JSON na TValuehodnotu .
[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
Parametry typu
- TValue
Typ pro deserializaci hodnoty JSON do.
Parametry
- options
- JsonSerializerOptions
Možnosti řízení chování při analýze
Návraty
Reprezentace TValue hodnoty JSON.
- Atributy
Výjimky
TValue není kompatibilní s JSON.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Platí pro
Deserialize<TValue>(JsonElement, JsonTypeInfo<TValue>)
Převede reprezentaci JsonElement jedné hodnoty JSON na TValuehodnotu .
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
Parametry typu
- TValue
Typ pro deserializaci hodnoty JSON do.
Parametry
- element
- JsonElement
Převod.JsonElement
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metadata o typu, který chcete převést.
Návraty
Reprezentace TValue hodnoty JSON.
Výjimky
jsonTypeInfo je null.
TValue není kompatibilní s JSON.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Platí pro
Deserialize<TValue>(JsonElement, JsonSerializerOptions)
Převede reprezentaci JsonElement jedné hodnoty JSON na TValuehodnotu .
[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
Parametry typu
- TValue
Typ pro deserializaci hodnoty JSON do.
Parametry
- element
- JsonElement
Převod.JsonElement
- options
- JsonSerializerOptions
Možnosti řízení chování při analýze
Návraty
Reprezentace TValue hodnoty JSON.
- Atributy
Výjimky
TValue není kompatibilní s JSON.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Platí pro
Deserialize<TValue>(JsonDocument, JsonSerializerOptions)
Převede reprezentaci JsonDocument jedné hodnoty JSON na TValuehodnotu .
[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
Parametry typu
- TValue
Typ pro deserializaci hodnoty JSON do.
Parametry
- document
- JsonDocument
Převod.JsonDocument
- options
- JsonSerializerOptions
Možnosti řízení chování při analýze
Návraty
Reprezentace TValue hodnoty JSON.
- Atributy
Výjimky
document je null.
TValue není kompatibilní s JSON.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Platí pro
Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)
Parsuje kódovaný text UTF-8 představující jednu hodnotu JSON do instance typu určeného parametrem obecného typu.
[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
Parametry typu
- TValue
Cílový typ zakódovaného textu UTF-8.
Parametry
- utf8Json
- ReadOnlySpan<Byte>
Text JSON, který se má analyzovat.
- options
- JsonSerializerOptions
Možnosti řízení chování při analýze
Návraty
Reprezentace TValue hodnoty JSON.
- Atributy
Výjimky
Json je neplatný.
nebo
TValue není kompatibilní s JSON.
nebo
Zbývající data jsou v rozsahu nad rámec jedné hodnoty JSON.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Poznámky
Další informace naleznete v tématu Jak serializovat a deserializovat JSON.
Platí pro
Deserialize<TValue>(String, JsonSerializerOptions)
Analyzuje text představující jednu hodnotu JSON do instance typu určeného parametrem obecného typu.
[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
Parametry typu
- TValue
Cílový typ hodnoty JSON.
Parametry
- json
- String
Text JSON, který se má analyzovat.
- options
- JsonSerializerOptions
Možnosti řízení chování při analýze
Návraty
Reprezentace TValue hodnoty JSON.
- Atributy
Výjimky
json je null.
Json je neplatný.
nebo
TValue není kompatibilní s JSON.
nebo
V řetězci jsou zbývající data nad rámec jedné hodnoty JSON.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Poznámky
String Použití metody UTF-8 není tak efektivní, protože implementace nativně používá UTF-8.
Další informace naleznete v tématu Jak serializovat a deserializovat JSON.
Platí pro
Deserialize<TValue>(ReadOnlySpan<Char>, JsonTypeInfo<TValue>)
Parsuje text představující jednu hodnotu JSON do objektu 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
Parametry typu
- TValue
Typ pro deserializaci hodnoty JSON do.
Parametry
- json
- ReadOnlySpan<Char>
Text JSON, který se má analyzovat
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metadata o typu, který chcete převést.
Návraty
Reprezentace TValue hodnoty JSON.
Výjimky
Json je neplatný.
nebo
TValue není kompatibilní s JSON.
nebo
V řetězci jsou zbývající data nad rámec jedné hodnoty JSON.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Poznámky
String Použití metody UTF-8 není tak efektivní, protože implementace nativně používá UTF-8.
Platí pro
Deserialize<TValue>(ReadOnlySpan<Char>, JsonSerializerOptions)
Analyzuje text představující jednu hodnotu JSON do instance typu určeného parametrem obecného typu.
[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
Parametry typu
- TValue
Typ pro deserializaci hodnoty JSON do.
Parametry
- json
- ReadOnlySpan<Char>
Text JSON, který se má analyzovat.
- options
- JsonSerializerOptions
Možnosti řízení chování při analýze
Návraty
Reprezentace TValue hodnoty JSON.
- Atributy
Výjimky
Json je neplatný.
nebo
TValue není kompatibilní s JSON.
nebo
Zbývající data jsou v rozsahu nad rámec jedné hodnoty JSON.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Poznámky
Použití rozsahu UTF-16 není tak efektivní jako použití metod UTF-8, protože implementace nativně používá UTF-8.
Platí pro
Deserialize<TValue>(ReadOnlySpan<Byte>, JsonTypeInfo<TValue>)
Parsuje kódovaný text UTF-8 představující jednu hodnotu JSON do objektu 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
Parametry typu
- TValue
Typ pro deserializaci hodnoty JSON do.
Parametry
- utf8Json
- ReadOnlySpan<Byte>
Text JSON, který se má analyzovat
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metadata o typu, který chcete převést.
Návraty
Reprezentace TValue hodnoty JSON.
Výjimky
JSON je neplatný, TValue není kompatibilní s JSON nebo ve streamu jsou zbývající data.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Platí pro
Deserialize<TValue>(Stream, JsonTypeInfo<TValue>)
Přečte kódovaný text UTF-8 představující jednu hodnotu JSON do objektu TValue.
Stream se přečte do dokončení.
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
Parametry typu
- TValue
Typ pro deserializaci hodnoty JSON do.
Parametry
- utf8Json
- Stream
Data JSON, která se mají analyzovat
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metadata o typu, který chcete převést.
Návraty
Reprezentace TValue hodnoty JSON.
Výjimky
utf8Json nebo jsonTypeInfo je null.
JSON je neplatný, TValue není kompatibilní s JSON nebo ve streamu jsou zbývající data.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Platí pro
Deserialize<TValue>(Stream, JsonSerializerOptions)
Přečte kódovaný text UTF-8 představující jednu hodnotu JSON do objektu TValue.
Stream se přečte do dokončení.
[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
Parametry typu
- TValue
Typ pro deserializaci hodnoty JSON do.
Parametry
- utf8Json
- Stream
Data JSON, která se mají analyzovat
- options
- JsonSerializerOptions
Možnosti řízení chování při čtení
Návraty
Reprezentace TValue hodnoty JSON.
- Atributy
Výjimky
utf8Json je null.
JSON je neplatný, TValue není kompatibilní s JSON nebo ve streamu jsou zbývající data.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Platí pro
Deserialize<TValue>(String, JsonTypeInfo<TValue>)
Parsuje text představující jednu hodnotu JSON do objektu 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
Parametry typu
- TValue
Typ pro deserializaci hodnoty JSON do.
Parametry
- json
- String
Text JSON, který se má analyzovat
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metadata o typu, který chcete převést.
Návraty
Reprezentace TValue hodnoty JSON.
Výjimky
Json je neplatný.
nebo
TValue není kompatibilní s JSON.
nebo
V řetězci jsou zbývající data nad rámec jedné hodnoty JSON.
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Poznámky
String Použití metody UTF-8 není tak efektivní, protože implementace nativně používá UTF-8.