JsonSerializer.SerializeToUtf8Bytes Method

Definition

Overloads

SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions)

Converts a value of the specified type into a JSON string, encoded as UTF-8 bytes.

SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)

Converts the value of a type specified by a generic type parameter into a JSON string, encoded as UTF-8 bytes.

SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions)

Converts a value of the specified type into a JSON string, encoded as UTF-8 bytes.

public static byte[] SerializeToUtf8Bytes (object value, Type inputType, System.Text.Json.JsonSerializerOptions options = null);
static member SerializeToUtf8Bytes : obj * Type * System.Text.Json.JsonSerializerOptions -> byte[]
Public Shared Function SerializeToUtf8Bytes (value As Object, inputType As Type, Optional options As JsonSerializerOptions = null) As Byte()

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

Byte[]

A JSON string representation of the value, encoded as UTF-8 bytes.

Remarks

For more information, see How to serialize and deserialize JSON.

SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)

Converts the value of a type specified by a generic type parameter into a JSON string, encoded as UTF-8 bytes.

public static byte[] SerializeToUtf8Bytes<TValue> (TValue value, System.Text.Json.JsonSerializerOptions options = null);
static member SerializeToUtf8Bytes : 'Value * System.Text.Json.JsonSerializerOptions -> byte[]
Public Shared Function SerializeToUtf8Bytes(Of TValue) (value As TValue, Optional options As JsonSerializerOptions = null) As Byte()

Type Parameters

TValue

The type of the value.

Parameters

value
TValue

The value to convert.

options
JsonSerializerOptions

Options to control the conversion behavior.

Returns

Byte[]

A JSON string representation of the value, encoded as UTF-8 bytes.

Remarks

For more information, see How to serialize and deserialize JSON.

Applies to