Getting Started
Architecture
NServiceBus
Transports
Persistence
ServiceInsight
ServicePulse
ServiceControl
Monitoring
Samples

Upgrading from community System.Text.Json serializer

Message serialization with System.Text.Json is bundled into NServiceBus version 8.1 and above. The built-in serializer is fully compatible with the community-created NServiceBus.Json package.

Conversion from community package

First, upgrade to NServiceBus 8.1.0 or newer.

Then, instead of:

var serialization = endpointConfiguration.UseSerialization<NServiceBus.Json.SystemJsonSerializer>();

Remove the reference to the NServiceBus.Json NuGet package and use:

var serialization = endpointConfiguration.UseSerialization<NServiceBus.SystemJsonSerializer>();

If full namespaces are not used, this code change may not be necessary, and instead, the using NServiceBus.Json; statement can be removed.

API differences

Specifying content type

The ContentTypeKey(...) method has been renamed to ContentType(...).

Options

The low level .ReaderOptions(...) and WriterOptions(...) is no longer available and it's recommended to use the JsonSerializerOptions to control serialization and deserialization behavior.

Related Articles

  • Serialization
    .NET messaging systems require serialization and deserialization of objects sent/received over transports. NServiceBus achieves this using serializers.