I want to return a result from a method in my ASP.NET MVC WebAPI application with the following signature:
public class Result
{
public int ResultCode { get; set; }
public MapFeatureViewModel Params { get; set; }
public string Message { get; set; }
}
and the MapFeatureViewModel type signature is
public class MapFeatureViewModel
{
public long Id { get; set; }
public string Uuid { get; set; }
public string Feature { get; set; }
public long MapId { get; set; }
}
Everything works fine till now; but if I try to change the type of Params in Result class to "object" or "dynamic" in order to use it for all other methods I receive the following error message:
"You must write an attribute 'type'='object' after writing the attribute with local name '__type'."
Any idea how to make WebAPI serialize non-strongly typed properties?