diff --git a/viper.go b/viper.go index ad8b658..fd279a4 100644 --- a/viper.go +++ b/viper.go @@ -1649,7 +1649,7 @@ func (v *Viper) marshalWriter(f afero.File, configType string) error { if sectionName == "default" { sectionName = "" } - cfg.Section(sectionName).Key(keyName).SetValue(cast.ToString(v.Get(key))) + cfg.Section(sectionName).Key(keyName).SetValue(v.GetString(key)) } cfg.WriteTo(f) }