Merge pull request #4568 from crobibero/guid-empty

Serialize Guid.Empty to null
This commit is contained in:
Claus Vium 2020-11-24 09:04:47 +01:00 committed by GitHub
commit 4ce9bf3fcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -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);
}
}
}
}