diff --git a/Source/VaultSharp.Extensions.Configuration/VaultConfigurationProvider.cs b/Source/VaultSharp.Extensions.Configuration/VaultConfigurationProvider.cs index 23ed6e8..4d178bf 100644 --- a/Source/VaultSharp.Extensions.Configuration/VaultConfigurationProvider.cs +++ b/Source/VaultSharp.Extensions.Configuration/VaultConfigurationProvider.cs @@ -176,7 +176,18 @@ private void SetData(IEnumerable> data, str var nestedKey = string.IsNullOrEmpty(key) ? pair.Key : $"{key}:{pair.Key}"; nestedKey = this.ReplaceTheAdditionalCharactersForConfigurationPath(nestedKey); - var nestedValue = (JsonElement)(object)pair.Value!; + JsonElement nestedValue; + + if (pair.Value == null) + { + using var doc = JsonDocument.Parse("null"); + nestedValue = doc.RootElement.Clone(); + } + else + { + nestedValue = (JsonElement)(object)pair.Value!; + } + this.SetItemData(nestedKey, nestedValue); } }