mirror of https://github.com/spf13/cast.git
StringMapE adapt to arrays
This commit is contained in:
parent
2b0eb0f724
commit
0cba87534e
5
caste.go
5
caste.go
|
@ -1095,6 +1095,11 @@ func ToStringMapE(i interface{}) (map[string]interface{}, error) {
|
|||
return m, nil
|
||||
case map[string]interface{}:
|
||||
return v, nil
|
||||
case []interface{}:
|
||||
for x := range v {
|
||||
m[ToString(x)] = v[x]
|
||||
}
|
||||
return m, nil
|
||||
case string:
|
||||
err := jsonStringToObject(v, &m)
|
||||
return m, err
|
||||
|
|
Loading…
Reference in New Issue