I have a simple class like so, which I'd like to serialize and send to the client in camel case notation.
I've declared the class in C# honoring the conventional Pascal case notation.
I've also set the JsonProperty
attribute on each property with a name override as follows.
using Newtonsoft.Json;
namespace Code.ViewModels
{
public class ArticleCategoryListItem
{
[JsonProperty(PropertyName = "value")]
public string Value { get; set; }
[JsonProperty(PropertyName = "label")]
public string Label { get; set; }
}
}
However, my client still receives Pascal case property names.
I've tried clearing the ASP.NET cache, cleaning the build and rebuilding the solution and restarting Visual Studio, all to no avail. What's going on?