Monday, August 17, 2015

Use camelCasing JSON

Add the following code in the WebApiConfig.cs file in the App_Start folder:

In the Register static method, add:

// Web API configuration and services
config.Formatters.JsonFormatter.SerializerSettings.ContractResolver =
                new CamelCasePropertyNamesContractResolver();

reference:
http://odetocode.com/blogs/scott/archive/2013/03/25/asp-net-webapi-tip-3-camelcasing-json.aspx

No comments: