From c4925ad70bd84477bd1e8df59de3db1196432fc2 Mon Sep 17 00:00:00 2001 From: crobibero Date: Mon, 23 Nov 2020 16:07:15 -0700 Subject: [PATCH] Serialize Guid.Empty to null --- .../Json/Converters/JsonGuidConverter.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Common/Json/Converters/JsonGuidConverter.cs b/MediaBrowser.Common/Json/Converters/JsonGuidConverter.cs index d35a761f3..54325a02b 100644 --- a/MediaBrowser.Common/Json/Converters/JsonGuidConverter.cs +++ b/MediaBrowser.Common/Json/Converters/JsonGuidConverter.cs @@ -15,6 +15,15 @@ namespace MediaBrowser.Common.Json.Converters /// public override void Write(Utf8JsonWriter writer, Guid value, JsonSerializerOptions options) - => writer.WriteStringValue(value); + { + if (value == Guid.Empty) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(value); + } + } } }