I have an object that implements an interface with a property that is another interface:
public interface IMaster
{
ISlave ObjectProp {get; set; }
}
public interface ISlave
{
string Name {get; set; }
}
...
public class Master : IMaster
{
public ISlave ObjectProp {get; set; }
}
public class Slave : ISlave
{
public string Name {get; set; }
}
I can create an instance of the Master class and deserialize it using JsonConvert.PopulateObject
.
When deserializing the property, however, the parser cannot, obviously, create an instance of an interface.
Is there a way to tell the Json library (via attribute, callback etc.) to create an instance of the Slave class (that implements the interface in question)?