Created
August 21, 2014 14:57
-
-
Save DavidDeSloovere/9d3f098d879fe5746f6d to your computer and use it in GitHub Desktop.
Camelcase JSON in Web Api
This file contains hidden or 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 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