JsonSerializer.SerializeToUtf8Bytes Método

Definição

Sobrecargas

Nome Description
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 bytes UTF-8.

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 como BYTES UTF-8.

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

Converte o valor fornecido em uma Byte matriz.

SerializeToUtf8Bytes(Object, JsonTypeInfo)

Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs

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 converter.

jsonTypeInfo
JsonTypeInfo

Metadados sobre o tipo a ser convertido.

Retornos

Byte[]

Uma representação UTF-8 do valor.

Exceções

jsonTypeInfo é null.

value não corresponde ao tipo de jsonTypeInfo.

Aplica-se a

SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions)

Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs

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

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member SerializeToUtf8Bytes : obj * Type * System.Text.Json.JsonSerializerOptions -> byte[]
static member SerializeToUtf8Bytes : obj * Type * System.Text.Json.JsonSerializerOptions -> byte[]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member SerializeToUtf8Bytes : obj * Type * System.Text.Json.JsonSerializerOptions -> byte[]
Public Function SerializeToUtf8Bytes (value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing) As Byte()
Public Shared Function SerializeToUtf8Bytes (value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing) As Byte()

Parâmetros

value
Object

O valor a converter.

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 de cadeia de caracteres JSON do valor, codificada como BYTES UTF-8.

Atributos

Exceções

inputType não é compatível com value.

inputType é null.

Não há nenhum membro compatível JsonConverterinputType ou serializável.

Comentários

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

Aplica-se a

SerializeToUtf8Bytes(Object, Type, JsonSerializerContext)

Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs

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 converter.

inputType
Type

O tipo do value a ser convertido.

context
JsonSerializerContext

Um provedor de metadados para tipos serializáveis.

Retornos

Byte[]

Uma representação UTF-8 do valor.

Exceções

inputType não é compatível com value.

inputType é null.

Não há nenhum membro compatível JsonConverterinputType ou serializável.

O GetTypeInfo(Type) método dos retornos null fornecidos context para o tipo a ser convertido.

Aplica-se a

SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)

Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs

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

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member SerializeToUtf8Bytes : 'Value * System.Text.Json.JsonSerializerOptions -> byte[]
static member SerializeToUtf8Bytes : 'Value * System.Text.Json.JsonSerializerOptions -> byte[]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member SerializeToUtf8Bytes : 'Value * System.Text.Json.JsonSerializerOptions -> byte[]
Public Function SerializeToUtf8Bytes(Of TValue) (value As TValue, Optional options As JsonSerializerOptions = Nothing) As Byte()
Public Shared Function SerializeToUtf8Bytes(Of TValue) (value As TValue, Optional options As JsonSerializerOptions = Nothing) As Byte()

Parâmetros de tipo

TValue

O tipo do valor.

Parâmetros

value
TValue

O valor a converter.

options
JsonSerializerOptions

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

Retornos

Byte[]

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

Atributos

Exceções

Não há nenhum membro compatível JsonConverterTValue ou serializável.

Comentários

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

Aplica-se a

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

Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs
Origem:
JsonSerializer.Write.ByteArray.cs

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 do valor a ser serializado.

Parâmetros

value
TValue

O valor a converter.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadados sobre o tipo a ser convertido.

Retornos

Byte[]

Uma representação UTF-8 do valor.

Exceções

Não há nenhum membro compatível JsonConverterTValue ou serializável.

jsonTypeInfo é null.

Aplica-se a