Answer the question
In order to leave comments, you need to log in
How to translate Entity framefork data into json data in WEB API?
How to translate Entity framefork data into json data? I use Angular + Web API.
Answer the question
In order to leave comments, you need to log in
In App_Start/WebApiConfig.cs add to the Register method
var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml");
config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);
var jsonFormatter = config.Formatters.OfType<JsonMediaTypeFormatter>().FirstOrDefault();
if (jsonFormatter != null)
jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
public IQueryable<Order> GetOrders()
{
return _db.Orders;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question