JsonSerializer.SerializeToNode Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Överlagringar
| Name | Description |
|---|---|
| SerializeToNode(Object, JsonTypeInfo) |
Konverterar det angivna värdet till en JsonNode. |
| SerializeToNode(Object, Type, JsonSerializerOptions) |
Konverterar det angivna värdet till en JsonNode. |
| SerializeToNode(Object, Type, JsonSerializerContext) |
Konverterar det angivna värdet till en JsonNode. |
| SerializeToNode<TValue>(TValue, JsonSerializerOptions) |
Konverterar det angivna värdet till en JsonNode. |
| SerializeToNode<TValue>(TValue, JsonTypeInfo<TValue>) |
Konverterar det angivna värdet till en JsonNode. |
SerializeToNode(Object, JsonTypeInfo)
Konverterar det angivna värdet till en JsonNode.
public:
static System::Text::Json::Nodes::JsonNode ^ SerializeToNode(System::Object ^ value, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static System.Text.Json.Nodes.JsonNode? SerializeToNode(object? value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member SerializeToNode : obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> System.Text.Json.Nodes.JsonNode
Public Function SerializeToNode (value As Object, jsonTypeInfo As JsonTypeInfo) As JsonNode
Parametrar
- value
- Object
Värdet som ska konverteras.
- jsonTypeInfo
- JsonTypeInfo
Metadata om vilken typ som ska konverteras.
Returer
En JsonNode representation av värdet.
Undantag
jsonTypeInfo är null.
value matchar inte typen av jsonTypeInfo.
Gäller för
SerializeToNode(Object, Type, JsonSerializerOptions)
Konverterar det angivna värdet till en JsonNode.
[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.Nodes.JsonNode? SerializeToNode(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.Nodes.JsonNode? SerializeToNode(object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default);
public static System.Text.Json.Nodes.JsonNode? SerializeToNode(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 SerializeToNode : obj * Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.Nodes.JsonNode
[<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 SerializeToNode : obj * Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.Nodes.JsonNode
static member SerializeToNode : obj * Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.Nodes.JsonNode
Public Function SerializeToNode (value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing) As JsonNode
Parametrar
- value
- Object
Värdet som ska konverteras.
- inputType
- Type
Typ av att value konvertera.
- options
- JsonSerializerOptions
Alternativ för att styra konverteringsbeteendet.
Returer
En JsonNode representation av värdet.
- Attribut
Undantag
inputType är inte kompatibelt med value.
inputType är null.
Det finns inga kompatibla JsonConverter för inputType eller dess serialiserbara medlemmar.
Gäller för
SerializeToNode(Object, Type, JsonSerializerContext)
Konverterar det angivna värdet till en JsonNode.
public:
static System::Text::Json::Nodes::JsonNode ^ SerializeToNode(System::Object ^ value, Type ^ inputType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static System.Text.Json.Nodes.JsonNode? SerializeToNode(object? value, Type inputType, System.Text.Json.Serialization.JsonSerializerContext context);
static member SerializeToNode : obj * Type * System.Text.Json.Serialization.JsonSerializerContext -> System.Text.Json.Nodes.JsonNode
Public Function SerializeToNode (value As Object, inputType As Type, context As JsonSerializerContext) As JsonNode
Parametrar
- value
- Object
Värdet som ska konverteras.
- inputType
- Type
Typ av att value konvertera.
- context
- JsonSerializerContext
En metadataprovider för serialiserbara typer.
Returer
En JsonNode representation av värdet.
Undantag
Det finns inga kompatibla JsonConverter för inputType eller dess serialiserbara medlemmar.
Metoden GetTypeInfo(Type) för de angivna context returnerar null för den typ som ska konverteras.
inputType eller context är null.
Gäller för
SerializeToNode<TValue>(TValue, JsonSerializerOptions)
Konverterar det angivna värdet till en JsonNode.
[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.Nodes.JsonNode? SerializeToNode<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.Nodes.JsonNode? SerializeToNode<TValue>(TValue value, System.Text.Json.JsonSerializerOptions? options = default);
public static System.Text.Json.Nodes.JsonNode? SerializeToNode<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 SerializeToNode : 'Value * System.Text.Json.JsonSerializerOptions -> System.Text.Json.Nodes.JsonNode
[<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 SerializeToNode : 'Value * System.Text.Json.JsonSerializerOptions -> System.Text.Json.Nodes.JsonNode
static member SerializeToNode : 'Value * System.Text.Json.JsonSerializerOptions -> System.Text.Json.Nodes.JsonNode
Public Function SerializeToNode(Of TValue) (value As TValue, Optional options As JsonSerializerOptions = Nothing) As JsonNode
Typparametrar
- TValue
Typ av värde som ska serialiseras.
Parametrar
- value
- TValue
Värdet som ska konverteras.
- options
- JsonSerializerOptions
Alternativ för att styra konverteringsbeteendet.
Returer
En JsonNode representation av JSON-värdet.
- Attribut
Undantag
Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.
Gäller för
SerializeToNode<TValue>(TValue, JsonTypeInfo<TValue>)
Konverterar det angivna värdet till en JsonNode.
public:
generic <typename TValue>
static System::Text::Json::Nodes::JsonNode ^ SerializeToNode(TValue value, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static System.Text.Json.Nodes.JsonNode? SerializeToNode<TValue>(TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member SerializeToNode : 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> System.Text.Json.Nodes.JsonNode
Public Function SerializeToNode(Of TValue) (value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue)) As JsonNode
Typparametrar
- TValue
Typ av värde som ska serialiseras.
Parametrar
- value
- TValue
Värdet som ska konverteras.
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metadata om vilken typ som ska konverteras.
Returer
En JsonNode representation av värdet.
Undantag
Det finns inga kompatibla JsonConverter för TValue eller dess serialiserbara medlemmar.
jsonTypeInfo är null.