diff --git a/encoding/gjson/gjson_api_new_load.go b/encoding/gjson/gjson_api_new_load.go index ecd737a6a..6abce4b5d 100644 --- a/encoding/gjson/gjson_api_new_load.go +++ b/encoding/gjson/gjson_api_new_load.go @@ -74,7 +74,7 @@ func NewWithTag(data interface{}, tags string, safe ...bool) *Json { i := interface{}(nil) // Note that it uses Map function implementing the converting. // Note that it here should not use MapDeep function if you really know what it means. - i = gconv.MapDeep(data, tags) + i = gconv.Map(data, tags) j = &Json{ p: &i, c: byte(gDEFAULT_SPLIT_CHAR), diff --git a/internal/json/json.go b/internal/json/json.go index 83ae6e4a8..ee7bc4b5d 100644 --- a/internal/json/json.go +++ b/internal/json/json.go @@ -13,8 +13,9 @@ import ( "io" ) -// ConfigCompatibleWithStandardLibrary tries to be 80% compatible +// ConfigCompatibleWithStandardLibrary tries to be 50% compatible // with standard library behavior. +// 50% - -! var json = jsoniter.ConfigCompatibleWithStandardLibrary // Marshal adapts to json/encoding Marshal API. @@ -49,8 +50,8 @@ func Unmarshal(data []byte, v interface{}) error { } // NewEncoder same as json.NewEncoder -func NewEncoder(writer io.Writer) *jsoniter.Encoder { - return json.NewEncoder(writer) +func NewEncoder(writer io.Writer) *json2.Encoder { + return json2.NewEncoder(writer) } // NewDecoder adapts to json/stream NewDecoder API. @@ -59,8 +60,8 @@ func NewEncoder(writer io.Writer) *jsoniter.Encoder { // // Instead of a json/encoding Decoder, an Decoder is returned // Refer to https://godoc.org/encoding/json#NewDecoder for more information. -func NewDecoder(reader io.Reader) *jsoniter.Decoder { - return json.NewDecoder(reader) +func NewDecoder(reader io.Reader) *json2.Decoder { + return json2.NewDecoder(reader) } // Valid reports whether data is a valid JSON encoding. diff --git a/other/test.go b/other/test.go deleted file mode 100644 index 302827a4c..000000000 --- a/other/test.go +++ /dev/null @@ -1,17 +0,0 @@ -package main - -import ( - "fmt" -) - -import jsoniter "github.com/json-iterator/go" - -var json = jsoniter.ConfigCompatibleWithStandardLibrary - -func main() { - body := "{\"id\": 413231383385427875}" - m := make(map[string]interface{}) - json.Unmarshal([]byte(body), &m) - b, _ := json.Marshal(m) - fmt.Println(string(b)) -}