Copied to clipboard

Flag this post as spam?

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


  • Chris Norwood 131 posts 642 karma points
    Mar 25, 2019 @ 13:46
    Chris Norwood
    0

    Returning JSON instead of IHtmlString?

    Hi there :)

    I really like the look of this package, but am having an issue getting the icons to render correctly.

    I'm using v1.6.0 of Iconic with Font Awesome Pro 5; I've set it up as per Chris Robinson's excellent guide here

    The Icons are displaying in the backend for selection as expected: enter image description here

    However, when I come to render the property, the property I'm getting back is of type JToken and contains the following JSON: {{ "icon": "fa-book",\r\n "packageId": "6dfd0a73-376d-498f-9065-76d0a3390738" }}

    Obviously rendering this just gives me the JSON as that's all that's in there, and I can't even parse the JSON to get the correct data as there's no sign of the fab/fas/fal prefix that's needed.

    I'm not sure if this is some mistake in my configuration or an issue with my setup - I'm using the ModelsBuilder with the models in a separate "core" project, where I've also installed Iconic, but nothing I do seems to make any difference to the value that comes back.

    This is how my package is set up for the solid icons, using the rules that Chris provided on Git:

    enter image description here

    Any suggestions/help gratefully received....!

  • Chris Norwood 131 posts 642 karma points
    Mar 27, 2019 @ 22:47
    Chris Norwood
    102

    I eventually figured this out, more or less by accident - I had installed Umbraco against .NET 4.5.2 originally, but 1.6.0 is built against a later version I think (there was a warning about this in the package manager console in Visual Studio).

    I updated my projects to use .NET 4.7.2 and re-installed the package, and (after some rather frustrating issues with System.Net.Http references) I'm now getting the HTML strings correctly instead of the JTokens.

Please Sign in or register to post replies

Write your reply to:

Draft