ArnoldV/Our.Umbraco.GMaps

Umbraco v8 (GMaps: 1.3.3) to Umbraco v10 (GMaps 3.0.0) legacy data value converter issues

Opened this issue · 1 comments

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.

{"address":{"latlng":"53.5879923, -2.5384524","full_address":"mansell house","postalcode":"bl6 6qq","city":"horwich","state":"england","country":"united kingdom"},"mapconfig":{"zoom":16,"maptype":"roadmap","mapcenter":"53.58793457153, -2.5383417500000194"}}

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?