Skip to content

Commit a2e5a6f

Browse files
chore: don't both writing null values
1 parent 2affa0a commit a2e5a6f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/EntityDb.Redis/Envelopes/JsonElementEnvelopeService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
using Microsoft.Extensions.Logging;
66
using System;
77
using System.Text.Json;
8+
using System.Text.Json.Serialization;
89

910
namespace EntityDb.Redis.Envelopes;
1011

1112
internal sealed class JsonElementEnvelopeService : IEnvelopeService<JsonElement>
1213
{
13-
private static readonly JsonSerializerOptions JsonSerializerOptions = new JsonSerializerOptions();
14+
private static readonly JsonSerializerOptions JsonSerializerOptions = new()
15+
{
16+
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
17+
};
18+
1419
private readonly ILogger<JsonElementEnvelopeService> _logger;
1520
private readonly ITypeResolver _typeResolver;
1621

0 commit comments

Comments
 (0)