I am not sure if I am doing it correct but on rc2-final release, this is how I am changing the serializerSettings on JsonInputFormatter:
private void ConfigureFormatters(MvcOptions options)
{
var serializerSettings = SerializerSettingsProvider.CreateSerializerSettings();
serializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
var jsonInputFormatter = new JsonInputFormatter(
_loggerFactory.CreateLogger<JsonInputFormatter>(),
serializerSettings,
ArrayPool<char>.Shared,
new DefaultObjectPoolProvider());
options.InputFormatters.RemoveType<JsonInputFormatter>();
options.InputFormatters.Insert(0, jsonInputFormatter);
}
which is a bit different than RC1 where the JsonInputFormatter constructor only accepted serializerSettings and now, I also care about arrayPool and pool provider. Is this is the way to replace the settings or is there a more unobtrusive way to do this?
@tugberkugurlu should be cleaner to add the following to your Startup.ConfigureServices() method:
c#
services
.AddMvc()
.AddJsonOptions(options => options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver());
Most helpful comment
@tugberkugurlu should be cleaner to add the following to your
Startup.ConfigureServices()method:c# services .AddMvc() .AddJsonOptions(options => options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver());