Configuration:
Problem:
When sending a DataTable
, Newtonsoft JSON is always changing the column captions to camelCase.
For example, a column called CostObjectKey
is shown as costObjectKey
after the transmission.
How can I stop Newtonsoft from doing this? I want my column captions unchanged.
In your startup's ConfigureServices
you can add MvcJsonOptions
.
services
.AddMvc()
.AddJsonOptions(options =>
{
options.SerializerSettings.ContractResolver =
new Newtonsoft.Json.Serialization.DefaultContractResolver();
});