Created
March 14, 2016 13:19
-
-
Save shahiddev/e82fea1c85d5e3faa710 to your computer and use it in GitHub Desktop.
JSON Camelcase properties
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
// Add framework services. | |
services.AddMvc(options => | |
{ | |
var json = options.OutputFormatters | |
.OfType<JsonOutputFormatter>() | |
.FirstOrDefault(); | |
if (json != null) | |
{ | |
json.SerializerSettings.ContractResolver = | |
new CamelCasePropertyNamesContractResolver(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's also a slightly easier way:
😁👍