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

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.

Leave a Comment