Skip to content

Instantly share code, notes, and snippets.

@DavidDeSloovere
Created August 21, 2014 14:57
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 DavidDeSloovere/9d3f098d879fe5746f6d to your computer and use it in GitHub Desktop.
Save DavidDeSloovere/9d3f098d879fe5746f6d to your computer and use it in GitHub Desktop.
Camelcase JSON in Web Api
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// just camel case
config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
// or camel case plus nicer formatting
var json = config.Formatters.JsonFormatter;
json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
json.SerializerSettings.Formatting = Formatting.Indented;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment