Last active
March 17, 2016 09:42
-
-
Save testfirstcoder/8fd6d9349a5a15918914 to your computer and use it in GitHub Desktop.
Serialize json attribute names in lower case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LowerCasePropertyNamesContractResolver : DefaultContractResolver | |
{ | |
protected override string ResolvePropertyName(string propertyName) => propertyName.ToLowerInvariant(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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