Add JsonConverter on Class without compilator attribute

42 Views Asked by At

I have a class ClientMessage with many derived class. I created a custom ClientMessageConverter with System.Text.Json.Serialization.

Is there a way to always use this converter on this class, as if i had [JsonConverter(typeof(ClientMessageConverter))] (I imported ClientMessage from a compiled assembly, so i cannot add a attribute on the class)

And ideally i would like to be exempt of creating JsonSerializerOptions everywhere in my code.

0

There are 0 best solutions below