I have an issue that I can't seem to solve.
I have the following class
public class Foo:IFoo
{
Private List<IBar> _listTest=new List<IBar>();
Public List<IBar> ListTest
{
get
{
return _listTest;
}
set
{
_listTest=value;
}
}
}
When I make a webapi call from an mvc app and it tries to deserialise it I get the following error
JsonSerializationException: Could not create an instance of type IBar. Type is an interface or abstract class and cannot be instantiated.
I know this can be fixed by changing the return type of the list in the interface to List but that seems like it is not a great idea.
What is the best way to get this to deserialise?