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