JsonSerializer.SerializeToUtf8Bytes Método

Definição

Sobrecargas

SerializeToUtf8Bytes(Object, JsonTypeInfo)

Converte o valor fornecido em uma Byte matriz.

SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions)

Converte um valor do tipo especificado em uma cadeia de caracteres JSON codificada como UTF-8 bytes.

SerializeToUtf8Bytes(Object, Type, JsonSerializerContext)

Converte o valor fornecido em uma Byte matriz.

SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)

Converte o valor de um tipo especificado por um parâmetro de tipo genérico em uma cadeia de caracteres JSON codificada em bytes UTF-8.

SerializeToUtf8Bytes<TValue>(TValue, JsonTypeInfo<TValue>)

Converte o valor fornecido em uma Byte matriz.

SerializeToUtf8Bytes(Object, JsonTypeInfo)

Converte o valor fornecido em uma Byte matriz.

public:
 static cli::array <System::Byte> ^ SerializeToUtf8Bytes(System::Object ^ value, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static byte[] SerializeToUtf8Bytes (object? value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member SerializeToUtf8Bytes : obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> byte[]
Public Function SerializeToUtf8Bytes (value As Object, jsonTypeInfo As JsonTypeInfo) As Byte()

Parâmetros

value
Object

O valor a ser convertido.

jsonTypeInfo
JsonTypeInfo

Metadados sobre o tipo a ser convertido.

Retornos

Byte[]

Uma representação em UTF-8 do valor.

Exceções

jsonTypeInfo é null.

value não corresponde ao tipo de jsonTypeInfo.

Aplica-se a

SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions)

Converte um valor do tipo especificado em uma cadeia de caracteres JSON codificada como UTF-8 bytes.

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

Parâmetros

value
Object

O valor a ser convertido.

inputType
Type

O tipo do value a ser convertido.

options
JsonSerializerOptions

Opções para controlar o comportamento de conversão.

Retornos

Byte[]

Uma representação da cadeia de caracteres JSON do valor codificada como bytes UTF-8.

Exceções

inputType não é compatível com value.

inputType é null.

Não há nenhum JsonConverter compatível para inputType nem para os respectivos membros serializáveis.

Comentários

Para obter mais informações, consulte Como serializar e desserializar o JSON.

Aplica-se a

SerializeToUtf8Bytes(Object, Type, JsonSerializerContext)

Converte o valor fornecido em uma Byte matriz.

public:
 static cli::array <System::Byte> ^ SerializeToUtf8Bytes(System::Object ^ value, Type ^ inputType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static byte[] SerializeToUtf8Bytes (object? value, Type inputType, System.Text.Json.Serialization.JsonSerializerContext context);
static member SerializeToUtf8Bytes : obj * Type * System.Text.Json.Serialization.JsonSerializerContext -> byte[]
Public Function SerializeToUtf8Bytes (value As Object, inputType As Type, context As JsonSerializerContext) As Byte()

Parâmetros

value
Object

O valor a ser convertido.

inputType
Type

O tipo do value a ser convertido.

context
JsonSerializerContext

Um provedor de metadados para tipos serializáveis.

Retornos

Byte[]

Uma representação em UTF-8 do valor.

Exceções

inputType não é compatível com value.

inputType é null.

Não há nenhum JsonConverter compatível para inputType nem para os respectivos membros serializáveis.

O GetTypeInfo(Type) método do fornecido context retorna null para o tipo a ser convertido.

Aplica-se a

SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)

Converte o valor de um tipo especificado por um parâmetro de tipo genérico em uma cadeia de caracteres JSON codificada em bytes UTF-8.

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

Parâmetros de tipo

TValue

Tipo do valor.

Parâmetros

value
TValue

O valor a ser convertido.

options
JsonSerializerOptions

Opções para controlar o comportamento de conversão.

Retornos

Byte[]

Uma representação da cadeia de caracteres JSON do valor codificada como bytes UTF-8.

Exceções

Não há nenhum JsonConverter compatível para TValue nem para os respectivos membros serializáveis.

Comentários

Para obter mais informações, consulte Como serializar e desserializar o JSON.

Aplica-se a

SerializeToUtf8Bytes<TValue>(TValue, JsonTypeInfo<TValue>)

Converte o valor fornecido em uma Byte matriz.

public:
generic <typename TValue>
 static cli::array <System::Byte> ^ SerializeToUtf8Bytes(TValue value, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static byte[] SerializeToUtf8Bytes<TValue> (TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member SerializeToUtf8Bytes : 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> byte[]
Public Function SerializeToUtf8Bytes(Of TValue) (value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue)) As Byte()

Parâmetros de tipo

TValue

O tipo de valor a serializar.

Parâmetros

value
TValue

O valor a ser convertido.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadados sobre o tipo a ser convertido.

Retornos

Byte[]

Uma representação em UTF-8 do valor.

Exceções

Não há nenhum JsonConverter compatível para TValue nem para os respectivos membros serializáveis.

jsonTypeInfo é null.

Aplica-se a