diff --git a/base/res_field.go b/base/res_field.go index beecea0..4e223fe 100644 --- a/base/res_field.go +++ b/base/res_field.go @@ -1,7 +1,6 @@ package base import ( - "encoding/json" "fmt" "reflect" "strconv" @@ -117,17 +116,17 @@ func (this ResField) ToValue(v any) any { case contracts.ResDataType_Json: if v == nil { if this.Default != "" && this.Default[0:1] == "[" { - return "[]" + return db.Raw("'[]'") } else if this.Default != "" && this.Default[0:1] == "{" { - return "{}" + return db.Raw("'{}'") } else if this.Default == "" { - return "{}" + return db.Raw("'{}'") } return this.Default } - b, _ := json.Marshal(v) - return string(b) + + return v } return strings.Trim(cast.ToString(v), " ")