Język

JsonSerializer.SerializeToElement Metoda

Definicja

Przeciążenia

Nazwa Opis
SerializeToElement(Object, Type, JsonSerializerOptions)

Konwertuje podaną wartość na JsonElementwartość .

SerializeToElement(Object, Type, JsonSerializerContext)

Konwertuje podaną wartość na JsonElementwartość .

SerializeToElement(Object, JsonTypeInfo)

Konwertuje podaną wartość na JsonElementwartość .

SerializeToElement<TValue>(TValue, JsonSerializerOptions)

Konwertuje podaną wartość na JsonElementwartość .

SerializeToElement<TValue>(TValue, JsonTypeInfo<TValue>)

Konwertuje podaną wartość na JsonElementwartość .

SerializeToElement(Object, Type, JsonSerializerOptions)

Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs

Konwertuje podaną wartość na JsonElementwartość .

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

Parametry

value
Object

Wartość do konwersji.

inputType
Type

Typ elementu do konwersji value .

options
JsonSerializerOptions

Opcje kontrolowania zachowania konwersji.

Zwraca

Reprezentacja JsonElement wartości.

Atrybuty

Wyjątki

inputType nie jest zgodny z value.

Parametr inputType ma wartość null.

Nie ma żadnych zgodnych JsonConverter elementów inputType członkowskich ani ich z możliwością serializacji.

Dotyczy

SerializeToElement(Object, Type, JsonSerializerContext)

Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs

Konwertuje podaną wartość na JsonElementwartość .

public:
 static System::Text::Json::JsonElement SerializeToElement(System::Object ^ value, Type ^ inputType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static System.Text.Json.JsonElement SerializeToElement(object? value, Type inputType, System.Text.Json.Serialization.JsonSerializerContext context);
static member SerializeToElement : obj * Type * System.Text.Json.Serialization.JsonSerializerContext -> System.Text.Json.JsonElement
Public Function SerializeToElement (value As Object, inputType As Type, context As JsonSerializerContext) As JsonElement

Parametry

value
Object

Wartość do konwersji.

inputType
Type

Typ elementu do konwersji value .

context
JsonSerializerContext

Dostawca metadanych dla typów możliwych do serializacji.

Zwraca

Reprezentacja JsonElement wartości.

Wyjątki

Nie ma żadnych zgodnych JsonConverter elementów inputType członkowskich ani ich z możliwością serializacji.

Metoda GetTypeInfo(Type) podanego context zwraca null typ do konwersji.

inputType lub context ma wartość null.

Dotyczy

SerializeToElement(Object, JsonTypeInfo)

Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs

Konwertuje podaną wartość na JsonElementwartość .

public:
 static System::Text::Json::JsonElement SerializeToElement(System::Object ^ value, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static System.Text.Json.JsonElement SerializeToElement(object? value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member SerializeToElement : obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> System.Text.Json.JsonElement
Public Function SerializeToElement (value As Object, jsonTypeInfo As JsonTypeInfo) As JsonElement

Parametry

value
Object

Wartość do konwersji.

jsonTypeInfo
JsonTypeInfo

Metadane dotyczące typu do konwersji.

Zwraca

Reprezentacja JsonElement wartości.

Wyjątki

Parametr jsonTypeInfo ma wartość null.

value nie jest zgodny z typem jsonTypeInfo.

Dotyczy

SerializeToElement<TValue>(TValue, JsonSerializerOptions)

Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs

Konwertuje podaną wartość na JsonElementwartość .

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

Parametry typu

TValue

Typ wartości do serializacji.

Parametry

value
TValue

Wartość do konwersji.

options
JsonSerializerOptions

Opcje kontrolowania zachowania konwersji.

Zwraca

Reprezentacja JsonElement wartości JSON.

Atrybuty

Wyjątki

Nie ma żadnych zgodnych JsonConverter elementów TValue członkowskich ani ich z możliwością serializacji.

Dotyczy

SerializeToElement<TValue>(TValue, JsonTypeInfo<TValue>)

Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs
Źródło:
JsonSerializer.Write.Element.cs

Konwertuje podaną wartość na JsonElementwartość .

public:
generic <typename TValue>
 static System::Text::Json::JsonElement SerializeToElement(TValue value, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static System.Text.Json.JsonElement SerializeToElement<TValue>(TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member SerializeToElement : 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> System.Text.Json.JsonElement
Public Function SerializeToElement(Of TValue) (value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue)) As JsonElement

Parametry typu

TValue

Typ wartości do serializacji.

Parametry

value
TValue

Wartość do konwersji.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadane dotyczące typu do konwersji.

Zwraca

Reprezentacja JsonElement wartości.

Wyjątki

Nie ma żadnych zgodnych JsonConverter elementów TValue członkowskich ani ich z możliwością serializacji.

Parametr jsonTypeInfo ma wartość null.

Dotyczy