Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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