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