Class JsonMessageSerializer
JSON message serializer using System.Text.Json.
Thread-safe, singleton-friendly. Configurable via .
public sealed class JsonMessageSerializer : IMessageSerializer
Inheritance
Implements
Properties
ContentType
Content type this serializer handles (e.g., "application/json").
public string ContentType { get; }
MediaTypes
All media types this serializer can handle, including structured-suffix aliases
public IReadOnlyCollection<string> MediaTypes { get; }
Methods
Deserialize(byte[], Type)
Deserializes a byte array to a typed value.
public object? Deserialize(byte[] data, Type type)
Deserialize<T>(byte[])
Deserializes a byte array to a typed value.
public T? Deserialize<T>(byte[] data)
Constructors
JsonMessageSerializer()
Creates a JSON serializer with default options.
JsonMessageSerializer(JsonSerializerOptions, string, IReadOnlyCollection<string>?)
Creates a JSON serializer with custom options, a specific primary content type,
JsonMessageSerializer(JsonSerializerOptions)
Creates a JSON serializer with custom options.