Hi,
i have a problem using the ReadInConfig method. I am loading data from a JSON file structured as follows:
[
{
"name": "sample1"
},
{
"name": "sample2"
}
]
When reading it using err = viper.ReadInConfig() i got the following error:
ERROR: 2015/07/03 Error parsing config: json: cannot unmarshal array into Go value of type map[string]interface {}
exit status 1
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
Most helpful comment
Is adding support to read from arrays a planned feature? If so, I would like to pick it up