Skip to content

Instantly share code, notes, and snippets.

@testfirstcoder
Last active March 17, 2016 09:42
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 testfirstcoder/8fd6d9349a5a15918914 to your computer and use it in GitHub Desktop.
Save testfirstcoder/8fd6d9349a5a15918914 to your computer and use it in GitHub Desktop.
Serialize json attribute names in lower case
public class LowerCasePropertyNamesContractResolver : DefaultContractResolver
{
protected override string ResolvePropertyName(string propertyName) => propertyName.ToLowerInvariant();
}
public class Startup
{
public void Configuration(IAppBuilder app)
{
var config = new HttpConfiguration();
config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new LowerCasePropertyNamesContractResolver();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment