I'm trying to implement JSON camel casing in my .Net API project. In my start up class I add the following lines:
config.Formatters.JsonFormatter.SerializerSettings.ContractResolver =
new CamelCasePropertyNamesContractResolver();
config.Formatters.JsonFormatter.UseDataContractJsonSerializer = false;
As I understand it this is what is required to implement camel casing on all routes. However when I add the following this fails to work, the responses come back as Pascal Case:
RouteTable.Routes.MapHttpRoute(
"DefaultApi",
"{controller}/{id}",
new {id = RouteParameter.Optional}
);
When I remove the above MapHttpRoute line and use Route attributes in the controllers instead camel casing works fine.
Has anyone any idea as to what is happening here?