Simplest example of this, I get a collection and try to output it via Web API:
// GET api/items
public IEnumerable- Get()
{
return MyContext.I
This helped me:
Add the following code in Application_Start
function of Global.asax.cs
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings
.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
GlobalConfiguration.Configuration.Formatters
.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter);