diff --git a/CHANGELOG.md b/CHANGELOG.md
index 83d7095..87e8902 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+## [1.2.3] - 2024-04-25
+
+### Changed
+
+- Parse empty strings as nullable Guid
+
## [1.2.2] - 2024-04-19
### Changed
diff --git a/Microsoft.Kiota.Serialization.Json.Tests/JsonParseNodeTests.cs b/Microsoft.Kiota.Serialization.Json.Tests/JsonParseNodeTests.cs
index 76f2dc9..6d2c56a 100644
--- a/Microsoft.Kiota.Serialization.Json.Tests/JsonParseNodeTests.cs
+++ b/Microsoft.Kiota.Serialization.Json.Tests/JsonParseNodeTests.cs
@@ -220,6 +220,23 @@ public void ParseGuidWithoutConverter()
Assert.Equal(id, entity.Id);
}
+ [Fact]
+ public void ParseGuidEmptyString()
+ {
+ // Arrange
+ var json = $"{{\"id\": \"\"}}";
+ var serializerOptions = new JsonSerializerOptions(JsonSerializerDefaults.General);
+ var serializationContext = new KiotaJsonSerializationContext(serializerOptions);
+ using var jsonDocument = JsonDocument.Parse(json);
+ var rootParseNode = new JsonParseNode(jsonDocument.RootElement, serializationContext);
+
+ // Act
+ var entity = rootParseNode.GetObjectValue(_ => new ConverterTestEntity());
+
+ // Assert
+ Assert.Null(entity.Id);
+ }
+
[Fact]
public void GetEntityWithUntypedNodesFromJson()
{
diff --git a/src/JsonParseNode.cs b/src/JsonParseNode.cs
index a64fd08..f91286e 100644
--- a/src/JsonParseNode.cs
+++ b/src/JsonParseNode.cs
@@ -125,9 +125,19 @@ public JsonParseNode(JsonElement node, KiotaJsonSerializationContext jsonSeriali
/// Get the guid value from the json node
///
/// A guid value
- public Guid? GetGuidValue() => _jsonNode.ValueKind == JsonValueKind.String
- ? _jsonNode.Deserialize(_jsonSerializerContext.Guid)
- : null;
+ public Guid? GetGuidValue()
+ {
+ if(_jsonNode.ValueKind != JsonValueKind.String)
+ return null;
+
+ if(_jsonNode.TryGetGuid(out var guid))
+ return guid;
+
+ if(string.IsNullOrEmpty(_jsonNode.GetString()))
+ return null;
+
+ return _jsonNode.Deserialize(_jsonSerializerContext.Guid);
+ }
///
/// Get the value from the json node
diff --git a/src/Microsoft.Kiota.Serialization.Json.csproj b/src/Microsoft.Kiota.Serialization.Json.csproj
index f552450..beffd07 100644
--- a/src/Microsoft.Kiota.Serialization.Json.csproj
+++ b/src/Microsoft.Kiota.Serialization.Json.csproj
@@ -15,7 +15,7 @@
https://aka.ms/kiota/docs
true
true
- 1.2.2
+ 1.2.3
true
true