Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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