Sean Kenny

CamelCaseJson

permalink

I prefer JSON camel cased. The default setup in ASP.net Web Api using the Newtonsoft JsonSerializer is for Pascal Case. To switch to camel case is easy and makes for a much more seamless angularJS and Web Api interaction. In the WebAPiConfig class:

1
2
var jsonFormatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();

Comments