You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jordan Gray edited this page Feb 4, 2014
·
11 revisions
Media Type Formatters are responsible of deserializing the HttpRequestMessage body into a object that will be used as an input in a controller action. It is also responsible for serialize the object returned in the HttpResponseMessage according to the MIME type set in the Accept header.
Additional formatters in WebApiContrib
ASP.NET Web API ships with two media type formatters, XmlMediaTypeFormatter and JsonMediaTypeFormatter. WebApiContrib contains the following media type formatters:
In general, to register a formatter to be used in your ASP.NET Web API application, add it to the Formatters collection in the GlobalConfiguration object.
protectedvoidApplication_Start(){GlobalConfiguration.Configuration.Formatters.Add(newServiceStackTextFormatter());// other registrations (routes, areas, global filters, etc)}
Check the documentation for the formatter you are using for more information on special parameters or requirements it may have.