There are ways to get ASP.NET MVC / WebApi to spit out camel cased Json object. This usually revolves around setting a format globally. However, when working with apps that are currently sending out wrongly cased Json, making a global change to flip the switch may be quite difficult, as who knows what’ll break. For these scenarios, it is better to configure settings like these on a more granular level. Enter IControllerConfiguration.
All you have to do is write an attribute that looks like the following:
With this in place, we can decorate any of our controllers with [CamelCasedJson], and it will output camel cased json output. This can be useful to gradually fix those Pasccal-cased-Json emitting controllers, or add newer functionality without having to keep on using broken conventions because other existing parts do it that way. One thing to note is that the model binders aren’t case sensitive. So whether you POST camel cased or Pascal cased JSon to the controller, you don’t need to take any additional measures. And of course, it’s not just Json serialisation format – you have access to a whole host of settings that you can set within that attribute or a per controller basis.
Hope that helps :)