diff --git a/viper.go b/viper.go index e4bdda0..055c638 100644 --- a/viper.go +++ b/viper.go @@ -1911,6 +1911,10 @@ func (v *Viper) flattenAndMergeMap(shadow map[string]bool, m map[string]any, pre if shadow == nil { shadow = make(map[string]bool) } + if len(m) == 0 && prefix != ""{ + shadow[strings.ToLower(prefix)]=true + return shadow + } var m2 map[string]any if prefix != "" {