Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Snippet from WebApiConfig.cs which shows how to setup the CamelCasePropertyName Json formatter
GlobalConfiguration.Configuration.Formatters.Remove(config.Formatters.XmlFormatter);
var jsonFormatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
jsonFormatter.UseDataContractJsonSerializer = false;
jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
GlobalConfiguration.Configuration.Formatters.Add(jsonFormatter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment