Open Volox opened 9 years ago
That is most likely because right now we assume that the root data structure of a json/yaml configuration is a map, not an array like in the above sample.
Ok, is there a plan for supporting them?
Ran into the same issue today.
json: cannot unmarshal array into Go value of type map[string]interface {}
Same issue for me and this is over 1 year old
Can this be supported via viper.GetStringMap("")
?
Ran into the same issue here, so i'll have to change the structure of json which isn't a big deal, but it would be nice if arrays could be supported.
Is adding support to read from arrays a planned feature? If so, I would like to pick it up
Also happens with a YAML config if the root level is an array:
2022/05/02 09:43:45 error reading config file: While parsing config: yaml: unmarshal errors:
line 1: cannot unmarshal !!seq into map[string]interface {}
While parsing config: json: cannot unmarshal array into Go value of type map[string]interface {}
still exist this problem........
who else in 2024?
Hi, i have a problem using the
ReadInConfig
method. I am loading data from a JSON file structured as follows:When reading it using
err = viper.ReadInConfig()
i got the following error: