JsonSerializer.SerializeToDocument 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 |
|---|---|
| SerializeToDocument(Object, JsonTypeInfo) |
Převede zadanou JsonDocumenthodnotu na hodnotu . |
| SerializeToDocument(Object, Type, JsonSerializerOptions) |
Převede zadanou JsonDocumenthodnotu na hodnotu . |
| SerializeToDocument(Object, Type, JsonSerializerContext) |
Převede zadanou JsonDocumenthodnotu na hodnotu . |
| SerializeToDocument<TValue>(TValue, JsonSerializerOptions) |
Převede zadanou JsonDocumenthodnotu na hodnotu . |
| SerializeToDocument<TValue>(TValue, JsonTypeInfo<TValue>) |
Převede zadanou JsonDocumenthodnotu na hodnotu . |
SerializeToDocument(Object, JsonTypeInfo)
Převede zadanou JsonDocumenthodnotu na hodnotu .
public:
static System::Text::Json::JsonDocument ^ SerializeToDocument(System::Object ^ value, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static System.Text.Json.JsonDocument SerializeToDocument(object? value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member SerializeToDocument : obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> System.Text.Json.JsonDocument
Public Function SerializeToDocument (value As Object, jsonTypeInfo As JsonTypeInfo) As JsonDocument
Parametry
- value
- Object
Hodnota, kterou chcete převést.
- jsonTypeInfo
- JsonTypeInfo
Metadata o typu, který chcete převést.
Návraty
Reprezentace JsonDocument hodnoty.
Výjimky
jsonTypeInfo je null.
valueneodpovídá typu .jsonTypeInfo
Platí pro
SerializeToDocument(Object, Type, JsonSerializerOptions)
Převede zadanou JsonDocumenthodnotu na hodnotu .
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Text.Json.JsonDocument SerializeToDocument(object? value, Type inputType, 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 System.Text.Json.JsonDocument SerializeToDocument(object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default);
public static System.Text.Json.JsonDocument SerializeToDocument(object? value, Type inputType, 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 SerializeToDocument : obj * Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
[<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 SerializeToDocument : obj * Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
static member SerializeToDocument : obj * Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
Public Function SerializeToDocument (value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing) As JsonDocument
Parametry
- value
- Object
Hodnota, kterou chcete převést.
- inputType
- Type
Typ převodu value .
- options
- JsonSerializerOptions
Možnosti pro řízení chování převodu
Návraty
Reprezentace JsonDocument hodnoty.
- Atributy
Výjimky
inputType není kompatibilní s value.
inputType je null.
Pro serializovatelné členy není kompatibilní JsonConverterinputType .
Platí pro
SerializeToDocument(Object, Type, JsonSerializerContext)
Převede zadanou JsonDocumenthodnotu na hodnotu .
public:
static System::Text::Json::JsonDocument ^ SerializeToDocument(System::Object ^ value, Type ^ inputType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static System.Text.Json.JsonDocument SerializeToDocument(object? value, Type inputType, System.Text.Json.Serialization.JsonSerializerContext context);
static member SerializeToDocument : obj * Type * System.Text.Json.Serialization.JsonSerializerContext -> System.Text.Json.JsonDocument
Public Function SerializeToDocument (value As Object, inputType As Type, context As JsonSerializerContext) As JsonDocument
Parametry
- value
- Object
Hodnota, kterou chcete převést.
- inputType
- Type
Typ převodu value .
- context
- JsonSerializerContext
Zprostředkovatel metadat pro serializovatelné typy.
Návraty
Reprezentace JsonDocument hodnoty.
Výjimky
Pro serializovatelné členy není kompatibilní JsonConverterinputType .
Metoda GetTypeInfo(Type) zadaného context návratu null pro typ, který se má převést.
inputType nebo context je null.
Platí pro
SerializeToDocument<TValue>(TValue, JsonSerializerOptions)
Převede zadanou JsonDocumenthodnotu na hodnotu .
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Text.Json.JsonDocument SerializeToDocument<TValue>(TValue value, 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 System.Text.Json.JsonDocument SerializeToDocument<TValue>(TValue value, System.Text.Json.JsonSerializerOptions? options = default);
public static System.Text.Json.JsonDocument SerializeToDocument<TValue>(TValue value, 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 SerializeToDocument : 'Value * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
[<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 SerializeToDocument : 'Value * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
static member SerializeToDocument : 'Value * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
Public Function SerializeToDocument(Of TValue) (value As TValue, Optional options As JsonSerializerOptions = Nothing) As JsonDocument
Parametry typu
- TValue
Typ hodnoty, která se má serializovat.
Parametry
- value
- TValue
Hodnota, kterou chcete převést.
- options
- JsonSerializerOptions
Možnosti pro řízení chování převodu
Návraty
Reprezentace JsonDocument hodnoty JSON.
- Atributy
Výjimky
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
Platí pro
SerializeToDocument<TValue>(TValue, JsonTypeInfo<TValue>)
Převede zadanou JsonDocumenthodnotu na hodnotu .
public:
generic <typename TValue>
static System::Text::Json::JsonDocument ^ SerializeToDocument(TValue value, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static System.Text.Json.JsonDocument SerializeToDocument<TValue>(TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member SerializeToDocument : 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> System.Text.Json.JsonDocument
Public Function SerializeToDocument(Of TValue) (value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue)) As JsonDocument
Parametry typu
- TValue
Typ hodnoty, která se má serializovat.
Parametry
- value
- TValue
Hodnota, kterou chcete převést.
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metadata o typu, který chcete převést.
Návraty
Reprezentace JsonDocument hodnoty.
Výjimky
Pro serializovatelné členy není kompatibilní JsonConverterTValue .
jsonTypeInfo je null.