In my MVC 5.2.7 project targeting .NET framework 4.6.1, I need to set the Json serializer settings to always to use came case.
So, I want to write in the Application_Start
event something like:
HttpConfiguration config = GlobalConfiguration.Configuration;
config.Formatters.JsonFormatter.SerializerSettings.ContractResolver =
new CamelCasePropertyNamesContractResolver();
Thing is: neither of the two HttpConfiguration
nor the GlobalConfiguration
classes are present in the MVC project.
I know that I can install the Web API related packages to get to these classes. The packages are:
1. Microsoft.AspNet.WebApi.Core; and
2. Microsoft.AspNet.WebApi.WebHost
But my question is: is there a native object inside MVC that gives me access to the Formatters
collection without having to install these packages?