Uredi

Deli z drugimi prek


JsonSerializer.SerializeToDocument Method

Definition

Overloads

SerializeToDocument(Object, JsonTypeInfo)

Converts the provided value into a JsonDocument.

SerializeToDocument(Object, Type, JsonSerializerOptions)

Converts the provided value into a JsonDocument.

SerializeToDocument(Object, Type, JsonSerializerContext)

Converts the provided value into a JsonDocument.

SerializeToDocument<TValue>(TValue, JsonSerializerOptions)

Converts the provided value into a JsonDocument.

SerializeToDocument<TValue>(TValue, JsonTypeInfo<TValue>)

Converts the provided value into a JsonDocument.

SerializeToDocument(Object, JsonTypeInfo)

Source:
JsonSerializer.Write.Document.cs
Source:
JsonSerializer.Write.Document.cs

Converts the provided value into a JsonDocument.

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

Parameters

value
Object

The value to convert.

jsonTypeInfo
JsonTypeInfo

Metadata about the type to convert.

Returns

A JsonDocument representation of the value.

Exceptions

jsonTypeInfo is null.

value does not match the type of jsonTypeInfo.

Applies to

SerializeToDocument(Object, Type, JsonSerializerOptions)

Source:
JsonSerializer.Write.Document.cs
Source:
JsonSerializer.Write.Document.cs
Source:
JsonSerializer.Write.Document.cs

Converts the provided value into a JsonDocument.

public static System.Text.Json.JsonDocument SerializeToDocument (object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default);
static member SerializeToDocument : obj * Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
Public Function SerializeToDocument (value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing) As JsonDocument

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 JsonDocument 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

SerializeToDocument(Object, Type, JsonSerializerContext)

Source:
JsonSerializer.Write.Document.cs
Source:
JsonSerializer.Write.Document.cs
Source:
JsonSerializer.Write.Document.cs

Converts the provided value into a JsonDocument.

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

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 JsonDocument 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

SerializeToDocument<TValue>(TValue, JsonSerializerOptions)

Source:
JsonSerializer.Write.Document.cs
Source:
JsonSerializer.Write.Document.cs
Source:
JsonSerializer.Write.Document.cs

Converts the provided value into a JsonDocument.

public static System.Text.Json.JsonDocument SerializeToDocument<TValue> (TValue value, System.Text.Json.JsonSerializerOptions? options = default);
static member SerializeToDocument : 'Value * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
Public Function SerializeToDocument(Of TValue) (value As TValue, Optional options As JsonSerializerOptions = Nothing) As JsonDocument

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 JsonDocument representation of the JSON value.

Exceptions

There is no compatible JsonConverter for TValue or its serializable members.

Applies to

SerializeToDocument<TValue>(TValue, JsonTypeInfo<TValue>)

Source:
JsonSerializer.Write.Document.cs
Source:
JsonSerializer.Write.Document.cs
Source:
JsonSerializer.Write.Document.cs

Converts the provided value into a JsonDocument.

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

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 JsonDocument representation of the value.

Exceptions

There is no compatible JsonConverter for TValue or its serializable members.

jsonTypeInfo is null.

Applies to