System.Text.Json default to number the enum serialization. In my case I need the string for that in the Startup.cs I add a converter to get all the enum serializing to string as is show here.
.AddJsonOptions(
c =>
{
c.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
}
);
but I have a particular enum that I need to serialize to number.
public enum fareStatus
{
None = 0,
Club = 1,
NoClub = 2
}
In this case I want to get 0,1,2 and not the string,
is that possible in this scenario? Thanks