I have started working over a POC to give a JSON response from the key value pairs content created in Tridion whose keys,values are not definite and can be anything.

I have tried using asp.net JavaScriptSerializer for serializing data into JSON and also Newtonsoft.Json in c# TBB. Somehow instead of using third party libraries I got inclined towards JavaScriptSerializer and now the issue is some of the html content is having html entities in the final output.

For example: If component A has a key Header and value as I am footer then my output after serializing is coming as { "Header": "\u003cdiv\u003eI am footer\u003c/div\u003e" }

I tried HttpUtility.HtmlDecode but it isn't working. Is there a way I can have a proper output or using Newtonsoft.Json is the only option left.

  • 1
    I would not prefer JavaScriptSerializer over JSON.NET; the latter is much more flexible and much faster. Commented Sep 29, 2016 at 17:30

2 Answers 2


There is one option

You can use latest dd4t publishing template which will output the content in json, then you don't need to perform any serialization however still getting desired output

Hope this helps.

  • You mean DD4T 2.0? If yes, we are not using DD4T and currently there is no plan to use it soon. Any other alternative?
    – Guest19876
    Commented Sep 29, 2016 at 10:10
  • In that case, either use newtonsoft.json or implement custom tbb that will do the same thing that dd4t tbb ll do.
    – Hiren Kaku
    Commented Sep 29, 2016 at 14:29

Use this Function:

public static string DecodeEncodedNonAsciiCharacters(string YourJSONOutput)
            return Regex.Replace(
               m =>
                    return ((char)int.Parse(m.Groups["Value"].Value, NumberStyles.HexNumber)).ToString();

This will help. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.