Click or drag to resize
Json.NETJsonObjectAttribute NamingStrategy setting
 

This sample uses NamingStrategy types specified on attributes to control serialized property names.

Sample
Types
1[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
2public class User
3{
4    public string FirstName { get; set; }
5    public string LastName { get; set; }
6    [JsonProperty(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
7    public int SnakeRating { get; set; }
8}
Usage
 1User user = new User
 2{
 3    FirstName = "Tom",
 4    LastName = "Riddle",
 5    SnakeRating = 10
 6};
 7
 8string json = JsonConvert.SerializeObject(user, Formatting.Indented);
 9
10Console.WriteLine(json);
11// {
12//   "firstName": "Tom",
13//   "lastName": "Riddle",
14//   "snake_rating": 10
15// }