.Net Core Renderer: Retrieving Related fields throws exception when no item is selected
In projects with enabled setting "Map related properties as objects" in Settings/Advanced/WebServices. In a custom view template, when trying to render a related media field (image) or related data field with this type of code: var field = item.GetValue("FieldName"); if image is not selected, the above code throws an exception: Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'Newtonsoft.Json.Linq.JObject'.