-
Notifications
You must be signed in to change notification settings - Fork 33
Description
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 options
https://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 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.