StringMapE adapt to arrays

This commit is contained in:
kayLeeo 2022-07-23 14:30:45 +08:00
parent 2b0eb0f724
commit 0cba87534e
1 changed files with 5 additions and 0 deletions

View File

@ -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