Utf8Json Serializer

Source
NuGet Package NServiceBus.Utf8Json (3.x) | License
This is a community maintained project. License and support are independent of Particular Software.
Target NServiceBus Version: 7.x

Using JSON via a NuGet dependency on Utf8Json.

Usage

endpointConfiguration.UseSerialization<Utf8JsonSerializer>();

Resolver

It is possible to customize the instance of IJsonFormatterResolver used for serialization.

var serialization = endpointConfiguration.UseSerialization<Utf8JsonSerializer>();
serialization.Resolver(StandardResolver.SnakeCase);

Custom content key

When using additional deserializers or transitioning between different versions of the same serializer it can be helpful to take explicit control over the content type a serializer passes to NServiceBus (to be used for the ContentType header).

var serialization = endpointConfiguration.UseSerialization<Utf8JsonSerializer>();
serialization.ContentTypeKey("custom-key");

Currently not supported

The use of DataBusProperty<T> is not supported because the property doesn't provide a default constructor. However, the use of the databus conventions is supported.

Samples


Last modified