Class MessageMetadataJsonConverter
Serializes MessageMetadata using a flat JSON object shape, preserving the wire contract that existed before the metadata fields were composed into focused value-type groups (MessageIdentity, MessageRouting, etc.).
public sealed class MessageMetadataJsonConverter : JsonConverter<MessageMetadata>
- Inheritance
-
MessageMetadataJsonConverter
- Inherited Members
- Extension Methods
Remarks
Composing the metadata into nested groups is a C# API concern only. This converter hoists the grouped fields back to the top level on write and routes flat fields back into the builder on read, so the serialized representation is unchanged for consumers and transports. The converter is hand-written (no reflection) and therefore AOT/trimming safe.
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type MessageMetadata.
public override MessageMetadata Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.
Returns
- MessageMetadata
The converted value.
Write(Utf8JsonWriter, MessageMetadata, JsonSerializerOptions)
Writes a specified value as JSON.
public override void Write(Utf8JsonWriter writer, MessageMetadata value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe writer to write to.
valueMessageMetadataThe value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.