Here is the easiest way that I have used in my applications. Add given below 3 lines of code in App_Start\\WebApiConfig.cs
in Register
function
var formatters = GlobalConfiguration.Configuration.Formatters;
formatters.Remove(formatters.XmlFormatter);
config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/json"));
Asp.net web API will automatically serialize your returning object to JSON and as the application/json
is added in the header so the browser or the receiver will understand that you are returning JSON result.