diff options
| author | crobibero <cody@robibe.ro> | 2020-11-23 16:07:15 -0700 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-11-23 16:07:15 -0700 |
| commit | c4925ad70bd84477bd1e8df59de3db1196432fc2 (patch) | |
| tree | abad8147c95811fe48564520c04f9b00d505c7ac | |
| parent | 02c1879533236b3aab5d15be58ea204aa1325206 (diff) | |
Serialize Guid.Empty to null
| -rw-r--r-- | MediaBrowser.Common/Json/Converters/JsonGuidConverter.cs | 11 |
1 files changed, 10 insertions, 1 deletions
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 /// <inheritdoc /> public override void Write(Utf8JsonWriter writer, Guid value, JsonSerializerOptions options) - => writer.WriteStringValue(value); + { + if (value == Guid.Empty) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(value); + } + } } } |
