JsonSerializer.SerializeToNode 方法

定義

多載

SerializeToNode(Object, JsonTypeInfo)

將所提供的值轉換成 JsonNode

SerializeToNode(Object, Type, JsonSerializerOptions)

將所提供的值轉換成 JsonNode

SerializeToNode(Object, Type, JsonSerializerContext)

將所提供的值轉換成 JsonNode

SerializeToNode<TValue>(TValue, JsonSerializerOptions)

將所提供的值轉換成 JsonNode

SerializeToNode<TValue>(TValue, JsonTypeInfo<TValue>)

將所提供的值轉換成 JsonNode

SerializeToNode(Object, JsonTypeInfo)

來源:
JsonSerializer.Write.Node.cs
來源:
JsonSerializer.Write.Node.cs

將所提供的值轉換成 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

參數

value
Object

要進行轉換的值。

jsonTypeInfo
JsonTypeInfo

要轉換之型別的相關中繼資料。

傳回

JsonNode值的表示。

例外狀況

jsonTypeInfonull

value 不符合 的類型 jsonTypeInfo

適用於

SerializeToNode(Object, Type, JsonSerializerOptions)

來源:
JsonSerializer.Write.Node.cs
來源:
JsonSerializer.Write.Node.cs
來源:
JsonSerializer.Write.Node.cs

將所提供的值轉換成 JsonNode

public static System.Text.Json.Nodes.JsonNode? SerializeToNode (object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default);
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

參數

value
Object

要進行轉換的值。

inputType
Type

要轉換的 value 類型。

options
JsonSerializerOptions

控制轉換行為的選項。

傳回

JsonNode值的表示。

例外狀況

inputTypevalue 不相容。

inputTypenull

inputType 或其可序列化成員沒有相容的 JsonConverter

適用於

SerializeToNode(Object, Type, JsonSerializerContext)

來源:
JsonSerializer.Write.Node.cs
來源:
JsonSerializer.Write.Node.cs
來源:
JsonSerializer.Write.Node.cs

將所提供的值轉換成 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

參數

value
Object

要進行轉換的值。

inputType
Type

要轉換的 value 類型。

context
JsonSerializerContext

可序列化類型的中繼資料提供者。

傳回

JsonNode值的表示。

例外狀況

inputType 或其可序列化成員沒有相容的 JsonConverter

提供的 GetTypeInfo(Type)context 方法會 null 傳回要轉換的型別。

inputTypecontextnull

適用於

SerializeToNode<TValue>(TValue, JsonSerializerOptions)

來源:
JsonSerializer.Write.Node.cs
來源:
JsonSerializer.Write.Node.cs
來源:
JsonSerializer.Write.Node.cs

將所提供的值轉換成 JsonNode

public static System.Text.Json.Nodes.JsonNode? SerializeToNode<TValue> (TValue value, System.Text.Json.JsonSerializerOptions? options = default);
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

類型參數

TValue

要序列化之值的類型。

參數

value
TValue

要進行轉換的值。

options
JsonSerializerOptions

控制轉換行為的選項。

傳回

JSON 值的 JsonNode 表示法。

例外狀況

TValue 或其可序列化成員沒有相容的 JsonConverter

適用於

SerializeToNode<TValue>(TValue, JsonTypeInfo<TValue>)

來源:
JsonSerializer.Write.Node.cs
來源:
JsonSerializer.Write.Node.cs
來源:
JsonSerializer.Write.Node.cs

將所提供的值轉換成 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

類型參數

TValue

要序列化之值的類型。

參數

value
TValue

要進行轉換的值。

jsonTypeInfo
JsonTypeInfo<TValue>

要轉換之型別的相關中繼資料。

傳回

JsonNode值的表示。

例外狀況

TValue 或其可序列化成員沒有相容的 JsonConverter

jsonTypeInfonull

適用於