diff --git a/app/app.go b/app/app.go index 024e840..54604cb 100644 --- a/app/app.go +++ b/app/app.go @@ -3,6 +3,7 @@ package app import ( "context" "github.com/go-redis/redis/v8" + "github.com/goccy/go-json" "github.com/gofiber/fiber/v2" "github.com/spf13/viper" "gofiber.study.skcks.cn/common/config" @@ -88,6 +89,8 @@ func reloadApp(c *config.BasicConfig) *fiber.App { } app := fiber.New(fiber.Config{ + JSONEncoder: json.Marshal, + JSONDecoder: json.Unmarshal, Prefork: c.Server.PreFork, CaseSensitive: c.Server.CaseSensitive, StrictRouting: c.Server.StrictRouting, diff --git a/common/utils/json.go b/common/utils/json.go index c1e0607..6c8ff62 100644 --- a/common/utils/json.go +++ b/common/utils/json.go @@ -1,7 +1,7 @@ package utils import ( - "encoding/json" + "github.com/goccy/go-json" ) func Json(data interface{}) string {