I know that there are JsonConverters that I can use for custom serialization / deserialization. But I do not want to apply this through attributes, but through code.
My framework has plugin support for serializers, and I'm going to add Newtonsoft JSON support now. And thus, I do not want to add newtonsoft-specific attributes to my types. Is there a way to apply JsonConverter to a specific type in any other way?
I would like to do something like:
serializer.AddTypeHandler(typeof(MyType), serializeFunction, deserializeFunction);
In any case, except for attributes, it would be nice.
source
share