Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created August 14, 2017 04:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save justinyoo/17b0dd5ff8353ccd350bf4ca051f2bf2 to your computer and use it in GitHub Desktop.
Swashbuckle Pro Tips for ASP.NET Web API #3
public static class WebApiConfig
{
public static void Register(IAppBuilder app, IContainer container)
{
var settings = new JsonSerializerSettings()
{
// Add JSON serialiser settings to support camelCasing.
ContractResolver = new CamelCasePropertyNamesContractResolver(),
...
};
var config = new HttpConfiguration();
...
var xmlFormatter = config.Formatters.XmlFormatter;
// Starts using XmlSerialiser rather than DataContractSerializer.
xmlFormatter.UseXmlSerializer = true;
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment