Hi
Since both SystemJsonSerializer and NewtonSoftSerializer are Json Serializer, is it possible to use both at the same time, because of in-flight messages still using NewtonSoftSerializer ?
I know that according to Serialization • NServiceBus • Particular Docs it is possible to have multiple serializers at the same time, but not sure two json serializers would cause issues or not
Hi @bfaccruent
I assume you would want to combine GitHub - NServiceBusExtensions/NServiceBus.Json: Add support for NServiceBus message serialization via System.Text.Json with the newtonsoft.json serializer?
The problem is that multiple serializers require to have different content type headers. So if both Json Serializers use application/json
then this wouldn’t work. The NServiceBus.Json package allows overriding the content type which then gets automatically propagated into the message headers but I wonder if it is worth the complexity because you would need to invent a derived content type like application/json+system
in order to distinguish the two which to me feels slightly strange given the broad compatibility of the two serializers.
Why not switch entirely to System.Text.Json? Do you have complex message hierarchies that might be a problem?
Regards,
Daniel
Hi @danielmarbach
Sorry for late reaction.
So at the moment we have our messages with NewtonSoft serialized but we also want to move completely to ‘System.Text.Json’, however I have no solution for in-flight messages at the same time.
Both serializers are quite compatible unless you are doing very advanced and complex hierarchies on your message types.
See the following comparison document