I am trying to use an HTTP Get request to pull an array from the C# WebAPI
I used the following code to get the list
[HttpGet]
[Route("api/Events/GetEvents")]
public List<Event> GetEvents()
{
db.Configuration.ProxyCreationEnabled = false;
List<Event> getevents = db.Events.ToList();
return getevents;
}
this is how the the JSON formatter used in Global.asx
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize;
GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter);
but this is the array that I get
{"$id":"1","$values":[{"$id":"2","Event_id":1,"Event_Name":"Soccer","Event_Date":"2021-12-02T00:00:00","Fixtures":{"$id":"3","$values":[]}},{"$id":"4","Event_id":2,"Event_Name":"Rugby","Event_Date":"2021-12-03T00:00:00","Fixtures":{"$id":"5","$values":[]}}]}
Anybody know how I can fix this?