替代WCF内置JavascriptSerializer与Newtonsoft Json.Net JSON序列 [英] replace WCF built-in JavascriptSerializer with Newtonsoft Json.Net json serializer

查看:837
本文介绍了替代WCF内置JavascriptSerializer与Newtonsoft Json.Net JSON序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法来取代WCF服务应用程序内置JavascriptSerializer与Newtonsoft Json.Net JSON序列化?

Is there any way to replace the WCF service application built-in JavascriptSerializer with Newtonsoft Json.Net json serializer?

推荐答案

WCF不使用 JavascriptSerializer 。它使用<一个href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer.aspx">DataContractJsonSerializer.是的,你可以用Json.NET通过写<一更换href="http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.idispatchmessageformatter.aspx">custom 的例举在<消息格式href="http://blogs.msdn.com/b/carlosfigueira/archive/2011/05/03/wcf-extensibility-message-formatters.aspx">following博客文章。

WCF doesn't use JavascriptSerializer. It uses DataContractJsonSerializer. And yes, you can replace it with Json.NET by writing a custom message formatter as exemplified in the following blog post.

这篇关于替代WCF内置JavascriptSerializer与Newtonsoft Json.Net JSON序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆