JsonSerializer.SerializeToElement Methode

Definitie

Overloads

Name Description
SerializeToElement(Object, Type, JsonSerializerContext)

Converteert de opgegeven waarde naar een JsonElement.

SerializeToElement(Object, Type, JsonSerializerOptions)

Converteert de opgegeven waarde naar een JsonElement.

SerializeToElement(Object, JsonTypeInfo)

Converteert de opgegeven waarde naar een JsonElement.

SerializeToElement<TValue>(TValue, JsonSerializerOptions)

Converteert de opgegeven waarde naar een JsonElement.

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

Converteert de opgegeven waarde naar een JsonElement.

SerializeToElement(Object, Type, JsonSerializerContext)

Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs

Converteert de opgegeven waarde naar een JsonElement.

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

Parameters

value
Object

De waarde die moet worden geconverteerd.

inputType
Type

Het type dat value u wilt converteren.

context
JsonSerializerContext

Een metagegevensprovider voor serialiseerbare typen.

Retouren

Een JsonElement weergave van de waarde.

Uitzonderingen

Er is geen compatibel JsonConverter voor inputType of de serialiseerbare leden.

De GetTypeInfo(Type) opgegeven context methode retourneert null het type dat moet worden geconverteerd.

inputType of context is null.

Van toepassing op

SerializeToElement(Object, Type, JsonSerializerOptions)

Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs

Converteert de opgegeven waarde naar een JsonElement.

[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

Parameters

value
Object

De waarde die moet worden geconverteerd.

inputType
Type

Het type dat value u wilt converteren.

options
JsonSerializerOptions

Opties voor het beheren van het conversiegedrag.

Retouren

Een JsonElement weergave van de waarde.

Kenmerken

Uitzonderingen

inputType is niet compatibel met value.

inputType is null.

Er is geen compatibel JsonConverter voor inputType of de serialiseerbare leden.

Van toepassing op

SerializeToElement(Object, JsonTypeInfo)

Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs

Converteert de opgegeven waarde naar een JsonElement.

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

Parameters

value
Object

De waarde die moet worden geconverteerd.

jsonTypeInfo
JsonTypeInfo

Metagegevens over het type dat moet worden geconverteerd.

Retouren

Een JsonElement weergave van de waarde.

Uitzonderingen

jsonTypeInfo is null.

value komt niet overeen met het type jsonTypeInfo.

Van toepassing op

SerializeToElement<TValue>(TValue, JsonSerializerOptions)

Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs

Converteert de opgegeven waarde naar een JsonElement.

[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

Type parameters

TValue

Het type van de waarde dat moet worden geserialiseerd.

Parameters

value
TValue

De waarde die moet worden geconverteerd.

options
JsonSerializerOptions

Opties voor het beheren van het conversiegedrag.

Retouren

Een JsonElement weergave van de JSON-waarde.

Kenmerken

Uitzonderingen

Er is geen compatibel JsonConverter voor TValue of de serialiseerbare leden.

Van toepassing op

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

Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs
Bron:
JsonSerializer.Write.Element.cs

Converteert de opgegeven waarde naar een JsonElement.

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

Type parameters

TValue

Het type van de waarde dat moet worden geserialiseerd.

Parameters

value
TValue

De waarde die moet worden geconverteerd.

jsonTypeInfo
JsonTypeInfo<TValue>

Metagegevens over het type dat moet worden geconverteerd.

Retouren

Een JsonElement weergave van de waarde.

Uitzonderingen

Er is geen compatibel JsonConverter voor TValue of de serialiseerbare leden.

jsonTypeInfo is null.

Van toepassing op