improve json validation rule for package gvalid
@@ -8,7 +8,7 @@ package gvalid
import (
"errors"
- "github.com/gogf/gf/encoding/gjson"
+ "github.com/gogf/gf/internal/json"
"github.com/gogf/gf/net/gipv4"
"github.com/gogf/gf/net/gipv6"
"github.com/gogf/gf/os/gtime"
@@ -452,7 +452,7 @@ func doCheckBuildInRules(
// Json.
case "json":
- if _, err := gjson.Decode([]byte(valueStr)); err == nil {
+ if json.Valid([]byte(valueStr)) {
match = true
}
