This commit is contained in:
cdle
2021-09-30 18:46:04 +08:00
parent e5c1df510f
commit 2489b6e3f5
+4 -1
View File
@@ -88,7 +88,10 @@ func init() {
return otto.Value{} return otto.Value{}
} }
if strings.Contains(dataType, "json") { if strings.Contains(dataType, "json") {
obj, _ := otto.New().Object(fmt.Sprintf(`(%s)`, data)) obj, err := otto.New().Object(fmt.Sprintf(`(%s)`, data))
if err != nil {
return otto.Value{}
}
return obj return obj
} }
result, err := otto.ToValue(data) result, err := otto.ToValue(data)