I have this code in my WebApiConfig.cs file and within the Register method:
var jsonFormatter=config.Formatters.JsonFormatter;
jsonFormatter.UseDataContractJsonSerializer = false;
jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
And yet despite this (and I did make sure this code was definitely being executed by using Debugger.Launch()) it is still outputting all my Json in Pascal Case.
Here is the code in the action method:
[HttpGet]
[Route("Details")]
public IHttpActionResult Details() {
using (var context = new Security.Context()) {
var user = context.Users.Current;
if (user == null) { return Json((object)null); }
return Json(user);
}
}
I can't see what I'm doing wrong, is there something I am missing?