Skip to content

Commit

Permalink
Avoid using deprecated API
Browse files Browse the repository at this point in the history
  • Loading branch information
khellang committed Aug 8, 2022
1 parent 84658c2 commit 2528bba
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/ProblemDetails.Tests/Helpers/FormattersExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
#if NET6_0_OR_GREATER
using System.Text.Json.Serialization;
#endif

namespace ProblemDetails.Tests.Helpers
{
Expand All @@ -12,7 +15,11 @@ public static IMvcCoreBuilder AddFormatters(this IMvcCoreBuilder mvc)

private static void ConfigureJson(JsonOptions json)
{
#if NET6_0_OR_GREATER
json.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
#else
json.JsonSerializerOptions.IgnoreNullValues = true;
#endif
}
}
}

0 comments on commit 2528bba

Please sign in to comment.