I am developing a very simply WebAPI in .Net 4.6. WebAPI, by default use JSON.Net as JSON serializer. For this application, I am willing to set default JSON serializer to NewtonSoft JSON.
Please help me how I can do this.
I am developing a very simply WebAPI in .Net 4.6. WebAPI, by default use JSON.Net as JSON serializer. For this application, I am willing to set default JSON serializer to NewtonSoft JSON.
Please help me how I can do this.
var formatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
formatter.SerializerSettings = new JsonSerializerSettings
{
Formatting = Formatting.Indented,
TypeNameHandling = TypeNameHandling.Objects,
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
Would be placed in your global.asax.cs
file.