Using Json.NET for text and binary Json payloads with WCF WebApi

There is an aging post by Christian on how to use the awesome Json.NET library as a default serializer for the new WCF Web Api.

Rather than having two media type formatters (in the latest bits lingo), I wanted to have a single one and have it pick the flavor of Json/Bson on the fly depending on the accept header on the request. This makes configuration simpler as you have to add only one formatter to the pipeline:

var config = HttpHostConfiguration.Create();
config.Configuration.OperationHandlerFactory.Formatters.Insert(0, new JsonNetMediaTypeFormatter());...

Read full article