Is there any way to replace the WCF service application built-in JavascriptSerializer with Newtonsoft Json.Net json serializer?
1 Answer
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.
5 Comments
iNc0ming
because DataContractJsonSerializer is much slower than Json.NET.
Darin Dimitrov
Is this a question that you are asking? Is there something else you would like to ask?
iNc0ming
ok, the question is going further now. According to this article - code.msdn.microsoft.com/windowsdesktop/…, I have made a custom DispatchFormatter, but how to register it to the wcf service application via web.config?
Darin Dimitrov
You could write a custom
IServiceBehavior to apply the message formatter globally to the service.