diff --git a/src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs b/src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs index d0f60d64b23..4af7f0c3489 100644 --- a/src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs +++ b/src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs @@ -73,7 +73,11 @@ public override ExportResult Export(in Batch batch) var options = new JsonSerializerOptions { WriteIndented = true, +#if NETSTANDARD || NETFRAMEWORK IgnoreNullValues = true, +#else + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, +#endif Converters = { new JsonStringEnumConverter(), }, };