You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we use default serialization options, but it would be nice to allow some customization in how the json looks (e.g. casing of property names. Similar thing was asked on npg: npgsql/efcore.pg#1107
The text was updated successfully, but these errors were encountered:
@maumar What are the default serialization options?
I was expecting that enum values are serialized to int values by default, but they are serialized as string values.
(Which is desired by myself but I'm curious why?)
enum Test { One, Two, Three }
[Fact]
public async Task Json_serialize_enum_as_int_value()
{
var test = Test.Two;
var json = System.Text.Json.JsonSerializer.Serialize(test);
json.Should().Be("1");
}
@alienwareone enum converted to string is pretty much only "customization" we do by default. The idea was that the JSON should be somewhat human-readable, so we decided to store it as strings.
Currently we use default serialization options, but it would be nice to allow some customization in how the json looks (e.g. casing of property names. Similar thing was asked on npg: npgsql/efcore.pg#1107
The text was updated successfully, but these errors were encountered: