JsonSerializer.SerializeToNode Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
SerializeToNode(Object, JsonTypeInfo) |
Converts the provided value into a JsonNode. |
SerializeToNode(Object, Type, JsonSerializerOptions) |
Converts the provided value into a JsonNode. |
SerializeToNode(Object, Type, JsonSerializerContext) |
Converts the provided value into a JsonNode. |
SerializeToNode<TValue>(TValue, JsonSerializerOptions) |
Converts the provided value into a JsonNode. |
SerializeToNode<TValue>(TValue, JsonTypeInfo<TValue>) |
Converts the provided value into a JsonNode. |
SerializeToNode(Object, JsonTypeInfo)
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
Converts the provided value into a 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
Parameters
- value
- Object
The value to convert.
- jsonTypeInfo
- JsonTypeInfo
Metadata about the type to convert.
Returns
A JsonNode representation of the value.
Exceptions
jsonTypeInfo
is null
.
value
does not match the type of jsonTypeInfo
.
Applies to
SerializeToNode(Object, Type, JsonSerializerOptions)
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
Converts the provided value into a 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
Parameters
- value
- Object
The value to convert.
- inputType
- Type
The type of the value
to convert.
- options
- JsonSerializerOptions
Options to control the conversion behavior.
Returns
A JsonNode representation of the value.
Exceptions
inputType
is not compatible with value
.
inputType
is null
.
There is no compatible JsonConverter for inputType
or its serializable members.
Applies to
SerializeToNode(Object, Type, JsonSerializerContext)
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
Converts the provided value into a 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
Parameters
- value
- Object
The value to convert.
- inputType
- Type
The type of the value
to convert.
- context
- JsonSerializerContext
A metadata provider for serializable types.
Returns
A JsonNode representation of the value.
Exceptions
There is no compatible JsonConverter for inputType
or its serializable members.
The GetTypeInfo(Type) method of the provided context
returns null
for the type to convert.
inputType
or context
is null
.
Applies to
SerializeToNode<TValue>(TValue, JsonSerializerOptions)
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
Converts the provided value into a 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
Type Parameters
- TValue
The type of the value to serialize.
Parameters
- value
- TValue
The value to convert.
- options
- JsonSerializerOptions
Options to control the conversion behavior.
Returns
A JsonNode representation of the JSON value.
Exceptions
There is no compatible JsonConverter for TValue
or its serializable members.
Applies to
SerializeToNode<TValue>(TValue, JsonTypeInfo<TValue>)
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
- Source:
- JsonSerializer.Write.Node.cs
Converts the provided value into a 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
Type Parameters
- TValue
The type of the value to serialize.
Parameters
- value
- TValue
The value to convert.
- jsonTypeInfo
- JsonTypeInfo<TValue>
Metadata about the type to convert.
Returns
A JsonNode representation of the value.
Exceptions
There is no compatible JsonConverter for TValue
or its serializable members.
jsonTypeInfo
is null
.