Table of Contents

Class Utf8JsonSerializer

Namespace
Azure.Iot.Operations.Services.SchemaRegistry
Assembly
Azure.Iot.Operations.Services.dll
public class Utf8JsonSerializer : IPayloadSerializer
Inheritance
Utf8JsonSerializer
Implements
Inherited Members

Fields

ContentType

public const string ContentType = "application/json"

Field Value

string

JsonSerializerOptions

protected static readonly JsonSerializerOptions JsonSerializerOptions

Field Value

JsonSerializerOptions

PayloadFormatIndicator

public const MqttPayloadFormatIndicator PayloadFormatIndicator = CharacterData

Field Value

MqttPayloadFormatIndicator

Methods

FromBytes<T>(ReadOnlySequence<byte>, string?, MqttPayloadFormatIndicator)

Deserialize the provided payload.

public T FromBytes<T>(ReadOnlySequence<byte> payload, string? contentType, MqttPayloadFormatIndicator payloadFormatIndicator) where T : class

Parameters

payload ReadOnlySequence<byte>

The byte array to deserialize.

contentType string

The content type of the MQTT message received with this payload.

payloadFormatIndicator MqttPayloadFormatIndicator

The payload format indicator of the MQTT message received with this payload.

Returns

T

The deserialized object.

Type Parameters

T

The type to deserialize into.

ToBytes<T>(T?)

Serialize the provided object.

public SerializedPayloadContext ToBytes<T>(T? payload) where T : class

Parameters

payload T

The object to serialize

Returns

SerializedPayloadContext

The serialized payload in a byte[] and the content type + payload format indicator used when serializing.

Type Parameters

T

The type to serialize