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
|
return m, nil
|
||||||
case map[string]interface{}:
|
case map[string]interface{}:
|
||||||
return v, nil
|
return v, nil
|
||||||
|
case []interface{}:
|
||||||
|
for x := range v {
|
||||||
|
m[ToString(x)] = v[x]
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
case string:
|
case string:
|
||||||
err := jsonStringToObject(v, &m)
|
err := jsonStringToObject(v, &m)
|
||||||
return m, err
|
return m, err
|
||||||
|
|
Loading…
Reference in New Issue