Avoid CamelCasePropertyNamesContractResolver for a specific method

I have web api controllers and I use this configuration method in the CamelCase WebApiConfig file for my results for all controllers.

var json = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();

Now I have a controller method that provides data to the Angularjs translation provider, and all the translation strings are not in camelcase in my html, which is why I need the results of this method so that they are not in CamelCase. Avoiding the serialization behavior of the camel body for this method of specific controllers.

+4
source share
1 answer

ApiController.Json.

return Json(data, new JsonSerializerSettings { ContractResolver = new DefaultContractResolver() });
+6

All Articles