Click or drag to resize
Json.NETCamel case property names
 

This sample uses a CamelCaseNamingStrategy specified using a contract resolver to camel case serialized property names.

Sample
Types
1public class User
2{
3    public string UserName { get; set; }
4    public bool Enabled { get; set; }
5}
Usage
 1User user1 = new User
 2{
 3    UserName = "jamesn",
 4    Enabled = true
 5};
 6
 7DefaultContractResolver contractResolver = new DefaultContractResolver
 8{
 9    NamingStrategy = new CamelCaseNamingStrategy()
10};
11
12string json = JsonConvert.SerializeObject(user1, new JsonSerializerSettings
13{
14    ContractResolver = contractResolver,
15    Formatting = Formatting.Indented
16});
17
18Console.WriteLine(json);
19// {
20//   "userName": "jamesn",
21//   "enabled": true
22// }