Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom 143 posts 253 karma points
    Jun 22, 2018 @ 11:09
    Tom
    0

    Invalid JSON primitive: Umbraco.Web.Models.RelatedLinks.

    I have upgraded from 7.5.9 to 7.6.5. In one of my partials, I have this code that worked in 7.5.9 is now giving me this error in 7.6.5. Invalid JSON primitive: Umbraco.Web.Models.RelatedLinks at line var links = Json.Decode(linksString);

            @{
                var linksString = Model.Links;
                if (linksString != null && !String.IsNullOrWhiteSpace(linksString))
                {
                    var links = Json.Decode(linksString);
                    foreach (var link in links)
                    {
                        <li><a href="@link.link">@link.caption</a></li>
                    }
                }
            }
    

    Can anyone help me resolve this?

    Thanks

  • Matthew Wise 257 posts 1182 karma points MVP c-trib
    Jun 22, 2018 @ 11:25
    Matthew Wise
    101

    Hi Tom,

    This will be the same issue as https://our.umbraco.org/forum/templates-partial-views-and-macros/92556-var-imageid-itemgetpropertyvalueint-backgroundimage-returning-0-when-it-should-be-1513

    Instead of getting the value as string it is now coming through as a strongly typed model.

    Matt

  • Tom 143 posts 253 karma points
    Jun 22, 2018 @ 11:28
    Tom
    0

    Yes, setting EnablePropertyValueConverters=false fixed this issue too!

    You're a genius!

    Tom

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies