-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Closed
Labels
Cost:SWork that requires one engineer up to 1 weekWork that requires one engineer up to 1 weekPriority:3Work that is nice to haveWork that is nice to haveTeam:LibrariesUser StoryA single user-facing feature. Can be grouped under an epic.A single user-facing feature. Can be grouped under an epic.api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Text.Jsonhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
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
JuanZamudioGBM, ivonin, ErikSchierboom, mmarquesbr, ejcoyle88 and 151 moremsschl, MartyIX, manojbaishya and Mrxx99msschl and Mrxx99
Metadata
Metadata
Assignees
Labels
Cost:SWork that requires one engineer up to 1 weekWork that requires one engineer up to 1 weekPriority:3Work that is nice to haveWork that is nice to haveTeam:LibrariesUser StoryA single user-facing feature. Can be grouped under an epic.A single user-facing feature. Can be grouped under an epic.api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Text.Jsonhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors