This commit is contained in:
hoteas 2017-11-13 10:20:35 +00:00
parent 6bb0bce557
commit 3ff1338b97

View File

@ -73,8 +73,10 @@ func ObjToSlice(obj interface{}, e ...*Error) Slice {
err = json.Unmarshal([]byte(obj.(string)), &v) err = json.Unmarshal([]byte(obj.(string)), &v)
default: default:
v = nil v = Slice{}
err = errors.New("没有合适的转换对象!") var data []byte
data, err = json.Marshal(obj)
err = json.Unmarshal(data, &v)
} }
} }