I'm currently upgrading an Umbraco 8 site to Umbraco 10+, GMaps 1.3.3 to 3.0.0. I'm getting parsing issues related to this package when reading & writing data using the Map object.
On debugging SingleMapPropertyValueConverter.cs I've found the following json isn't successfully deserializing into the LegacyMap object.
Both the Address and MapConfig properties are just null for the intermediate variable.
I've managed to resolve this by applying the following changes:
LegacyAddress.cs - changing LatLng from internal to public. Adding [JsonPropertyName("latlng")].
LegacyMapConfig.cs - changing MapCenter from internal to public. Adding [JsonPropertyName("MapCenter")]. In addition, I've also removed the Zoom property as I found it an unnecessary addition, and zoom parses perfectly fine without it.
SingleMapPropertyValueConverter.cs - Removed Line 50 (model.MapConfig.Zoom = ...)
I hope this helps solidify this awesome package, and/or helps anybody else facing similar issues.
@robertjf @ArnoldV this issue is still there, It looks like if the properties of LegacyMap are internal it doesn't get converted using System.Text.Json, is it possible to make the properties public as suggested?
I'm currently upgrading an Umbraco 8 site to Umbraco 10+, GMaps 1.3.3 to 3.0.0. I'm getting parsing issues related to this package when reading & writing data using the
Map
object.On debugging
SingleMapPropertyValueConverter.cs
I've found the following json isn't successfully deserializing into theLegacyMap
object.Both the
Address
andMapConfig
properties are justnull
for theintermediate
variable.I've managed to resolve this by applying the following changes:
LegacyAddress.cs
- changingLatLng
frominternal
topublic
. Adding[JsonPropertyName("latlng")]
.LegacyMapConfig.cs
- changingMapCenter
frominternal
topublic
. Adding[JsonPropertyName("MapCenter")]
. In addition, I've also removed theZoom
property as I found it an unnecessary addition, and zoom parses perfectly fine without it.SingleMapPropertyValueConverter.cs
- Removed Line 50 (model.MapConfig.Zoom = ...
)I hope this helps solidify this awesome package, and/or helps anybody else facing similar issues.