C# WCF REST - How do you use JSON.Net serializer instead of the default DataContractSerializer?

后端 未结 1 1250
梦如初夏
梦如初夏 2020-11-27 22:23

In .NET 3.5, Is it possible to override the default DataContractJsonSerializer and use the JSON.net serializer instead?

NOTE: We do not want to use

相关标签:
1条回答
  • Yes, it's possible to do so. But it's not too simple. You'll need a new message formatter which uses the JSON.NET serializer instead of the default one to convert between the operation parameters and the message object needed by the WCF stack. The post at http://blogs.msdn.com/b/carlosfigueira/archive/2011/05/03/wcf-extensibility-message-formatters.aspx has an example that does exactly that. The code is written for 4.0, but it should work for 3.5 as well.

    0 讨论(0)
提交回复
热议问题