Contents below were taken from @khellang, thanks!
API Proposal
Add additional casing support for System.Text.Json, based on this comment.
namespace System.Text.Json;
public partial class JsonNamingPolicy
{
public static JsonNamingPolicy CamelCase { get; }
+ public static JsonNamingPolicy SnakeLowerCase { get; }
+ public static JsonNamingPolicy SnakeUpperCase { get; }
+ public static JsonNamingPolicy KebabLowerCase { get; }
+ public static JsonNamingPolicy KebabUpperCase { get; }
}
public enum JsonKnownNamingPolicy
{
Unspecified = 0,
CamelCase = 1,
+ SnakeLowerCase = 2,
+ SnakeUpperCase = 3,
+ KebabLowerCase = 4,
+ KebabUpperCase = 5,
}
Behavior Proposal
I propose the same behavior as Newtonsoft.Json, just like the existing camel case behavior. The implementation is here and the tests are here.
Other Comments
I think snake case naming is pretty common, especially in the Ruby world, and should be supported out of the box. GitHub's API is probably the most popular example using this naming convention off the top of my head.
Implements
See: dotnet/corefx#40003
Contents below were taken from @khellang, thanks!
API Proposal
Add additional casing support for
System.Text.Json, based on this comment.namespace System.Text.Json; public partial class JsonNamingPolicy { public static JsonNamingPolicy CamelCase { get; } + public static JsonNamingPolicy SnakeLowerCase { get; } + public static JsonNamingPolicy SnakeUpperCase { get; } + public static JsonNamingPolicy KebabLowerCase { get; } + public static JsonNamingPolicy KebabUpperCase { get; } } public enum JsonKnownNamingPolicy { Unspecified = 0, CamelCase = 1, + SnakeLowerCase = 2, + SnakeUpperCase = 3, + KebabLowerCase = 4, + KebabUpperCase = 5, }Behavior Proposal
I propose the same behavior as Newtonsoft.Json, just like the existing camel case behavior. The implementation is here and the tests are here.
Other Comments
I think snake case naming is pretty common, especially in the Ruby world, and should be supported out of the box. GitHub's API is probably the most popular example using this naming convention off the top of my head.
Implements
See: dotnet/corefx#40003