I'm using ASP.NET Web API and I'm trying to return an instance of a class that looks like this:
public class Whatever
{
public int MyInt {get; set;}
public IFoo MyFoo {get; set;}
}
When this instance gets serialized to JSON, the IFoo member (which could be an instance of any of a number of classes implementing IFoo) gets serialized oddly. The property name is written, but its value is a huge chunk of HTML containing an error message like this:
You must write an attribute 'type'='object' after writing the attribute with local name '__type'.
Is this the framework telling me that it doesn't know how to serialize an instance cast as an interface? Or something else?