#30956 seems to have been the original request for this, however it's closed as completed, but there is still no support for JSON Serialization of interfaces as of .Net 7...?
Following through this chain of issues #30956 -> #30083 -> #63747 -> #71346
It's suggested in the implementation noted in #63747 that the following would allow for interface de-serialization:
[JsonPolymorphic(UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToNearestAncestor)]
[JsonDerivedType(typeof(Node))]
interface INode
{
string Value { get; set; }
}
class Node : INode
{
public string Value { get; set; }
}
// Should be able to de-serialize to this
class MyClass
{
public INode Value { get; set; }
}
Hhowever doing something similar to this results in a pretty clear exception:
System.NotSupportedException: Deserialization of interface types is not supported
All threads I could find related to this feature are closed as completed. So here I am!
Is this a feature already tracked?
#30956 seems to have been the original request for this, however it's closed as completed, but there is still no support for JSON Serialization of interfaces as of .Net 7...?
Following through this chain of issues #30956 -> #30083 -> #63747 -> #71346
It's suggested in the implementation noted in #63747 that the following would allow for interface de-serialization:
Hhowever doing something similar to this results in a pretty clear exception:
All threads I could find related to this feature are closed as completed. So here I am!
Is this a feature already tracked?