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
JsonSerializerOptions
protected static readonly JsonSerializerOptions JsonSerializerOptions
Field Value
PayloadFormatIndicator
public const MqttPayloadFormatIndicator PayloadFormatIndicator = CharacterData
Field Value
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
stringThe content type of the MQTT message received with this payload.
payloadFormatIndicator
MqttPayloadFormatIndicatorThe 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
TThe 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