开发者

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

&lt;blockquote&gt;&lt;p&gt;Test&lt;&lt;/p&gt;&lt;/blockquote&gt;

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜