Copied to clipboard

Flag this post as spam?

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


  • Michal Koblasa 45 posts 139 karma points
    Jan 13, 2015 @ 17:37
    Michal Koblasa
    0

    Macro - JSON property editor

    Hello,

    i need to create macro with property editor, which stores JSON. I added property editor: Textarea, but it encodes JSON (it is with whitespaces and html entity chars) like that in DB (jsut first lines):

    {\n\t"type": "serial",\n\t"pathToImages": "http://cdn.amcharts.com/lib/3/images/",\n\t"categoryField": 

    My input was (just first lines):

    {
    "type": "serial",
    "pathToImages": "http://cdn.amcharts.com/lib/3/images/",
    "categoryField": "sloupec"

    I need to store it as it is. Or i need to get the original data in macro razzor script.

    Do i need to create custom property editor like here: http://www.nibble.be/?p=349 or is there any more elegant way to do it?

    Thank you for your ideas

  • Michal Koblasa 45 posts 139 karma points
    Jan 13, 2015 @ 19:51
    Michal Koblasa
    0

    Ok, that code solved my problem for this time:

    @Html.Raw(HttpUtility.HtmlDecode(chartData.ToString()))

    But im sure, there is some way how to store it without html entity decoding.

    But still i cannot edit the JSON after saving. Because i see only in property editor: 

    [object Object]

Please Sign in or register to post replies

Write your reply to:

Draft