Here's an example code in case the link in the answer above dies
public class MerlinStringMediaTypeFormatter : MediaTypeFormatter { public MerlinStringMediaTypeFormatter() { SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/plain")); } public override bool CanReadType(Type type) { return type == typeof (YourObject);
Then you need to register your formatter in Global.asax
protected void Application_Start() { config.Formatters.Add(new MerlinStringMediaTypeFormatter()); }
Hope this saves you some time.
Matas vaitkevicius
source share