9

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

1 Answer 1

17

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.

Sign up to request clarification or add additional context in comments.

5 Comments

because DataContractJsonSerializer is much slower than Json.NET.
Is this a question that you are asking? Is there something else you would like to ask?
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?
You could write a custom IServiceBehavior to apply the message formatter globally to the service.
By following this article - link, all works now, thank u guys for help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.