Skip to content

Commit 16e1806

Browse files
committed
Avoid writing nulls and default values to JSON logging
1 parent d8ea153 commit 16e1806

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Extensions/Console/JsonConsoleOptions.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ namespace Devlooped.Extensions.AI;
1212
/// </summary>
1313
public class JsonConsoleOptions
1414
{
15-
static readonly JsonSerializerOptions jsonOptions = new(JsonSerializerDefaults.Web);
15+
static readonly JsonSerializerOptions jsonOptions = new(JsonSerializerDefaults.Web)
16+
{
17+
DefaultIgnoreCondition =
18+
System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull |
19+
System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault
20+
};
1621

1722
/// <summary>
1823
/// Default settings for rendering JSON output to the console, which include:

0 commit comments

Comments
 (0)