Skip to content

Instantly share code, notes, and snippets.

@SimonDoy
Created May 20, 2016 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SimonDoy/35285feebcb9cf5494bd03a55375638a to your computer and use it in GitHub Desktop.
Save SimonDoy/35285feebcb9cf5494bd03a55375638a to your computer and use it in GitHub Desktop.
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