I tried to change from Newtonsoft.Json to System.Text.Json, Im using custom converters for a custom class MyType.
In both cases I implement a converter with JsonConverter MyType as a base class and it works fine if I try to serialize a class which has a property of the type MyType (so far).
But there is a major difference if I change my property from MyType to List of MyType it will still work just fine in Newtonsoft.Json and my converter is called for every list entry, but with System.Text.Json my converter doesn't work anymore, because my converter CanConvert is called with the type parameter List instead of MyType, so my converter returns false and will not be used for the serialization.
So it looks like Newtonsoft is just smarter and detects that the property is a list and will invoke the converter for every list member instead of trying to pass the whole list to the converter.
Is this a bug or a "feature"? Is there a workaround? Because it's a major issues since the same thing worked in Newtonsoft and I think it would be silly to reimplement the serialization logic for lists and even add a special check in my converter to detect if I want to serialize MyType itself or List because it should work in both cases (and it did work in Newtonsoft by default).