瀏覽代碼

chore: use internal/json (#1791)

田欧 6 年之前
父節點
當前提交
a5dda62cdc
共有 3 個文件被更改,包括 6 次插入1 次删除
  1. 2 1
      binding/form_mapping.go
  2. 2 0
      internal/json/json.go
  3. 2 0
      internal/json/jsoniter.go

+ 2 - 1
binding/form_mapping.go

@@ -5,12 +5,13 @@
 package binding
 
 import (
-	"encoding/json"
 	"errors"
 	"reflect"
 	"strconv"
 	"strings"
 	"time"
+
+	"github.com/gin-gonic/gin/internal/json"
 )
 
 var errUnknownType = errors.New("Unknown type")

+ 2 - 0
internal/json/json.go

@@ -11,6 +11,8 @@ import "encoding/json"
 var (
 	// Marshal is exported by gin/json package.
 	Marshal = json.Marshal
+	// Unmarshal is exported by gin/json package.
+	Unmarshal = json.Unmarshal
 	// MarshalIndent is exported by gin/json package.
 	MarshalIndent = json.MarshalIndent
 	// NewDecoder is exported by gin/json package.

+ 2 - 0
internal/json/jsoniter.go

@@ -12,6 +12,8 @@ var (
 	json = jsoniter.ConfigCompatibleWithStandardLibrary
 	// Marshal is exported by gin/json package.
 	Marshal = json.Marshal
+	// Unmarshal is exported by gin/json package.
+	Unmarshal = json.Unmarshal
 	// MarshalIndent is exported by gin/json package.
 	MarshalIndent = json.MarshalIndent
 	// NewDecoder is exported by gin/json package.