JSON.NET encoding
I have a bbcode parser which parse bbcode on the server side into html string and then present the result as html to end users using JQuery on the client side.
When i return the object using JSON.NET's .SerailizeObject, by default, it encodes all html.
JsonConvert.SerializeObject(MyBBCodeObject, Formatting.None)
My original already 'Parsed" html string is
<blockquote><p>test</p></blockquote>
and 开发者_运维知识库JSON.NET's serializer returns
<blockquote><p>Test<</p></blockquote>
My question is, how do I prevent JSON.NET from html encoding my already "Parsed" (a property MyBBCodeObject) string?
The result is, I have to use JQuery template's {{html}} to decode them when presented to the user, and that caused an additional 4 seconds load time.
Any advice is greatly appreciated it.
Don't know how to close this thread, so I'll just answer my own question.
Thanks again to @Marc. It's the .asmx web service that is encoding my response. I'll just use httphandler for this purpose.
精彩评论