Trying to set JsonOutputFormatter options:
var jsonFormatter = (JsonOutputFormatter) options.OutputFormatters.FirstOrDefault(f => f is JsonOutputFormatter);
if (jsonFormatter != null)
{
jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
}
or
mvcBuilder.AddJsonOptions(jsonOptions =>
{
jsonOptions.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
});
But as soon as I add this, I get:
MissingMethodException: Method not found: 'Newtonsoft.Json.JsonSerializerSettings Microsoft.AspNet.Mvc.Formatters.JsonOutputFormatter.get_SerializerSettings()'.
I'm using the standard Microsoft.AspNet.Mvc.Formatters.Json (6.0.0-rc1-final)
Edit: Solved it by installing Newtonsoft.Json 6.0.6
(which downgrades all other references)
Anyone got that already? Thanks..