I am trying to configure a scope to use some of the custom JSON serializer settings for a newly created scope in an ASP.Net project. I am writing a web API controller.
Unfortunately, I cannot affect the whole project (a lot of legacy code), otherwise I would just do:
var json = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
json.SerializerSettings.Converters = new List<JsonConverter>() { new StringEnumConverter() };
But I can change this new area, but I consider it necessary.
Is it possible to set up this new area (there are other areas that I don’t want to touch, either) in the same way as above?
source
share