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
I don't think when using System.Text.Json the JsonStringEnumConvertor supports snake_case EnumMember
If I replace the convertor with my own simply reverting to newtonsoft it's back working...
//model = JsonSerializer.Deserialize<Map>(jsonString);
model = Newtonsoft.Json.JsonConvert.DeserializeObject<Map?>(jsonString);
Having a look around and seems lots of issues supporting enums with snake case, hamburger case... and doesn't seem to be a quick googled solution :-( In my limited understanding it seems that JsonStringEnumConverter is only allowing matching on lowercased propertyname and not respecting the actual EnumMember?
Although JsonStringEnumConverter does address the straight conversion between an enum and its direct string representation, it does not in fact address cases where the string is not a direct match to the enum value.
Same occurs deserialising the map style for a styled_map, reverting to newtonsoft again resolves.
// jsontext fails to deserialize this too ???//var style = JsonSerializer.Deserialize<MapStyle?>(ms);varstyle=Newtonsoft.Json.JsonConvert.DeserializeObject<MapStyle?>(ms);model.MapConfig.Style=style?.Selectedstyle?.Json;
UMB 13.3.2 and GMaps 3.0.2
In the property convertor deserialising with System.Text.Json is failing for me when mapType is
map_styled
works with other optionshttps://github.com/ArnoldV/Our.Umbraco.GMaps/blob/develop/Our.Umbraco.GMaps.Core/PropertyValueConverter/SingleMapPropertyValueConverter.cs#L43
[System.Text.Json.Serialization.JsonConverter(typeof(JsonStringEnumConverter))] public MapType? MapType { get; set; }
I don't think when using
System.Text.Json
the JsonStringEnumConvertor supports snake_case EnumMemberIf I replace the convertor with my own simply reverting to newtonsoft it's back working...
Having a look around and seems lots of issues supporting enums with snake case, hamburger case... and doesn't seem to be a quick googled solution :-( In my limited understanding it seems that
JsonStringEnumConverter
is only allowing matching on lowercased propertyname and not respecting the actual EnumMember?Although JsonStringEnumConverter does address the straight conversion between an enum and its direct string representation, it does not in fact address cases where the string is not a direct match to the enum value.
dotnet/runtime#74385
The text was updated successfully, but these errors were encountered: