Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Last active February 21, 2016 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/58785e8e8b9f277bb690 to your computer and use it in GitHub Desktop.
Save justinyoo/58785e8e8b9f277bb690 to your computer and use it in GitHub Desktop.
ASP.NET Core Tips & Tricks
public IServiceProvider ConfigureServices(IServiceCollection services)
{
var builder = services.AddMvc();
builder.AddJsonOptions(
o =>
{
o.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
o.SerializerSettings.Converters.Add(new StringEnumConverter());
o.SerializerSettings.Formatting = Formatting.Indented;
o.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
o.SerializerSettings.MissingMemberHandling = MissingMemberHandling.Ignore;
});
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment