From b2aa59d8934d922a38fa6dd603850098ecbc8919 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 17 Jun 2020 21:16:25 +0800 Subject: [PATCH] import third-party library json-iterator to improve the performance for json operations --- container/garray/garray_normal_any.go | 2 +- container/garray/garray_normal_int.go | 2 +- container/garray/garray_normal_str.go | 2 +- container/garray/garray_sorted_any.go | 2 +- container/garray/garray_sorted_int.go | 2 +- container/garray/garray_sorted_str.go | 2 +- .../garray_z_unit_normal_any_array_test.go | 2 +- .../garray_z_unit_normal_int_array_test.go | 2 +- .../garray_z_unit_normal_str_array_test.go | 2 +- .../garray_z_unit_sorted_any_array_test.go | 2 +- .../garray_z_unit_sorted_int_array_test.go | 2 +- .../garray_z_unit_sorted_str_array_test.go | 2 +- container/glist/glist.go | 2 +- container/glist/glist_z_unit_test.go | 2 +- container/gmap/gmap_hash_any_any_map.go | 2 +- container/gmap/gmap_hash_int_any_map.go | 2 +- container/gmap/gmap_hash_int_int_map.go | 2 +- container/gmap/gmap_hash_int_str_map.go | 2 +- container/gmap/gmap_hash_str_any_map.go | 2 +- container/gmap/gmap_hash_str_int_map.go | 2 +- container/gmap/gmap_hash_str_str_map.go | 2 +- container/gmap/gmap_list_map.go | 2 +- container/gmap/gmap_z_unit_any_any_test.go | 2 +- container/gmap/gmap_z_unit_int_any_test.go | 2 +- container/gmap/gmap_z_unit_int_int_test.go | 2 +- container/gmap/gmap_z_unit_int_str_test.go | 2 +- container/gmap/gmap_z_unit_list_map_test.go | 2 +- container/gmap/gmap_z_unit_str_any_test.go | 2 +- container/gmap/gmap_z_unit_str_int_test.go | 2 +- container/gmap/gmap_z_unit_str_str_test.go | 2 +- container/gmap/gmap_z_unit_tree_map_test.go | 2 +- container/gset/gset_any_set.go | 2 +- container/gset/gset_int_set.go | 2 +- container/gset/gset_str_set.go | 2 +- container/gset/gset_z_unit_any_test.go | 2 +- container/gset/gset_z_unit_int_test.go | 2 +- container/gset/gset_z_unit_str_test.go | 2 +- container/gtree/gtree_avltree.go | 2 +- container/gtree/gtree_btree.go | 2 +- container/gtree/gtree_redblacktree.go | 2 +- container/gtype/interface.go | 2 +- container/gtype/z_bench_json_test.go | 2 +- container/gtype/z_unit_bool_test.go | 2 +- container/gtype/z_unit_byte_test.go | 2 +- container/gtype/z_unit_bytes_test.go | 2 +- container/gtype/z_unit_float32_test.go | 2 +- container/gtype/z_unit_float64_test.go | 2 +- container/gtype/z_unit_int32_test.go | 2 +- container/gtype/z_unit_int64_test.go | 2 +- container/gtype/z_unit_int_test.go | 2 +- container/gtype/z_unit_interface_test.go | 2 +- container/gtype/z_unit_string_test.go | 2 +- container/gtype/z_unit_uint32_test.go | 2 +- container/gtype/z_unit_uint64_test.go | 2 +- container/gtype/z_unit_uint_test.go | 2 +- container/gvar/gvar_imp.go | 2 +- container/gvar/gvar_z_unit_json_test.go | 2 +- database/gdb/gdb_z_mysql_join_test.go | 6 +- database/gredis/gredis_conn.go | 2 +- encoding/gini/gini.go | 2 +- encoding/gjson/gjson_api_encoding.go | 2 +- encoding/gjson/gjson_api_new_load.go | 2 +- encoding/gjson/gjson_stdlib_json_util.go | 2 +- encoding/gjson/gjson_z_unit_basic_test.go | 2 +- .../gjson/gjson_z_unit_implements_test.go | 2 +- encoding/gtoml/gtoml.go | 2 +- encoding/gyaml/gyaml.go | 2 +- encoding/gyaml/gyaml_test.go | 2 +- go.mod | 1 + internal/json/json.go | 69 +++++++++++++++++++ net/ghttp/ghttp_client_request.go | 2 +- net/ghttp/ghttp_request_param.go | 2 +- net/ghttp/ghttp_response_write.go | 2 +- net/ghttp/ghttp_server_router_serve.go | 2 +- net/ghttp/ghttp_unit_param_json_test.go | 2 +- os/gbuild/gbuild.go | 2 +- os/gcmd/gcmd_parser.go | 2 +- os/gproc/gproc_comm_receive.go | 2 +- os/gproc/gproc_comm_send.go | 2 +- os/gres/gres_file.go | 2 +- os/gsession/gsession_storage_file.go | 2 +- os/gsession/gsession_storage_redis.go | 2 +- os/gtime/gtime_z_unit_json_test.go | 2 +- other/test.go | 17 +++++ util/gconv/gconv.go | 2 +- util/gconv/gconv_map.go | 2 +- util/gconv/gconv_slice.go | 2 +- util/gconv/gconv_z_unit_struct_test.go | 2 +- util/gutil/gutil_dump.go | 2 +- 89 files changed, 175 insertions(+), 88 deletions(-) create mode 100644 internal/json/json.go create mode 100644 other/test.go diff --git a/container/garray/garray_normal_any.go b/container/garray/garray_normal_any.go index 559350235..08e1697e0 100644 --- a/container/garray/garray_normal_any.go +++ b/container/garray/garray_normal_any.go @@ -8,10 +8,10 @@ package garray import ( "bytes" - "encoding/json" "errors" "fmt" "github.com/gogf/gf/internal/empty" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/text/gstr" "math" "sort" diff --git a/container/garray/garray_normal_int.go b/container/garray/garray_normal_int.go index 52df40bdf..3f850a87f 100644 --- a/container/garray/garray_normal_int.go +++ b/container/garray/garray_normal_int.go @@ -8,9 +8,9 @@ package garray import ( "bytes" - "encoding/json" "errors" "fmt" + "github.com/gogf/gf/internal/json" "math" "sort" diff --git a/container/garray/garray_normal_str.go b/container/garray/garray_normal_str.go index fc562ed3f..acf3e784c 100644 --- a/container/garray/garray_normal_str.go +++ b/container/garray/garray_normal_str.go @@ -8,9 +8,9 @@ package garray import ( "bytes" - "encoding/json" "errors" "fmt" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/text/gstr" "math" "sort" diff --git a/container/garray/garray_sorted_any.go b/container/garray/garray_sorted_any.go index 0a1aeec3c..d056464d7 100644 --- a/container/garray/garray_sorted_any.go +++ b/container/garray/garray_sorted_any.go @@ -8,9 +8,9 @@ package garray import ( "bytes" - "encoding/json" "fmt" "github.com/gogf/gf/internal/empty" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/text/gstr" "github.com/gogf/gf/util/gutil" "math" diff --git a/container/garray/garray_sorted_int.go b/container/garray/garray_sorted_int.go index e75bd5cf0..28d3e97f9 100644 --- a/container/garray/garray_sorted_int.go +++ b/container/garray/garray_sorted_int.go @@ -8,8 +8,8 @@ package garray import ( "bytes" - "encoding/json" "fmt" + "github.com/gogf/gf/internal/json" "math" "sort" diff --git a/container/garray/garray_sorted_str.go b/container/garray/garray_sorted_str.go index 933def543..649732347 100644 --- a/container/garray/garray_sorted_str.go +++ b/container/garray/garray_sorted_str.go @@ -8,7 +8,7 @@ package garray import ( "bytes" - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/text/gstr" "math" "sort" diff --git a/container/garray/garray_z_unit_normal_any_array_test.go b/container/garray/garray_z_unit_normal_any_array_test.go index d59584b53..6b29f1a2f 100644 --- a/container/garray/garray_z_unit_normal_any_array_test.go +++ b/container/garray/garray_z_unit_normal_any_array_test.go @@ -9,8 +9,8 @@ package garray_test import ( - "encoding/json" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "testing" "time" diff --git a/container/garray/garray_z_unit_normal_int_array_test.go b/container/garray/garray_z_unit_normal_int_array_test.go index 66f1f2357..9f8252828 100644 --- a/container/garray/garray_z_unit_normal_int_array_test.go +++ b/container/garray/garray_z_unit_normal_int_array_test.go @@ -9,8 +9,8 @@ package garray_test import ( - "encoding/json" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "testing" "time" diff --git a/container/garray/garray_z_unit_normal_str_array_test.go b/container/garray/garray_z_unit_normal_str_array_test.go index 10866fbd0..56e08155a 100644 --- a/container/garray/garray_z_unit_normal_str_array_test.go +++ b/container/garray/garray_z_unit_normal_str_array_test.go @@ -9,8 +9,8 @@ package garray_test import ( - "encoding/json" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "strings" "testing" "time" diff --git a/container/garray/garray_z_unit_sorted_any_array_test.go b/container/garray/garray_z_unit_sorted_any_array_test.go index 02f9562bd..b95b08d67 100644 --- a/container/garray/garray_z_unit_sorted_any_array_test.go +++ b/container/garray/garray_z_unit_sorted_any_array_test.go @@ -9,8 +9,8 @@ package garray_test import ( - "encoding/json" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gutil" "strings" "testing" diff --git a/container/garray/garray_z_unit_sorted_int_array_test.go b/container/garray/garray_z_unit_sorted_int_array_test.go index 3a44ea38b..6903f4518 100644 --- a/container/garray/garray_z_unit_sorted_int_array_test.go +++ b/container/garray/garray_z_unit_sorted_int_array_test.go @@ -9,8 +9,8 @@ package garray_test import ( - "encoding/json" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "testing" "time" diff --git a/container/garray/garray_z_unit_sorted_str_array_test.go b/container/garray/garray_z_unit_sorted_str_array_test.go index 9b60b1e3a..3581cbdc5 100644 --- a/container/garray/garray_z_unit_sorted_str_array_test.go +++ b/container/garray/garray_z_unit_sorted_str_array_test.go @@ -9,8 +9,8 @@ package garray_test import ( - "encoding/json" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "testing" "time" diff --git a/container/glist/glist.go b/container/glist/glist.go index d347fbddf..2b4b68bdd 100644 --- a/container/glist/glist.go +++ b/container/glist/glist.go @@ -11,7 +11,7 @@ package glist import ( "bytes" "container/list" - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "github.com/gogf/gf/internal/rwmutex" diff --git a/container/glist/glist_z_unit_test.go b/container/glist/glist_z_unit_test.go index 63b5d1d22..2c04169ac 100644 --- a/container/glist/glist_z_unit_test.go +++ b/container/glist/glist_z_unit_test.go @@ -8,7 +8,7 @@ package glist import ( "container/list" - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/test/gtest" "github.com/gogf/gf/util/gconv" diff --git a/container/gmap/gmap_hash_any_any_map.go b/container/gmap/gmap_hash_any_any_map.go index e51da00d1..1420cdd0f 100644 --- a/container/gmap/gmap_hash_any_any_map.go +++ b/container/gmap/gmap_hash_any_any_map.go @@ -7,7 +7,7 @@ package gmap import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/internal/empty" diff --git a/container/gmap/gmap_hash_int_any_map.go b/container/gmap/gmap_hash_int_any_map.go index 4b4b93520..9cf218920 100644 --- a/container/gmap/gmap_hash_int_any_map.go +++ b/container/gmap/gmap_hash_int_any_map.go @@ -8,7 +8,7 @@ package gmap import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/internal/empty" diff --git a/container/gmap/gmap_hash_int_int_map.go b/container/gmap/gmap_hash_int_int_map.go index 7969430b8..d37e8d453 100644 --- a/container/gmap/gmap_hash_int_int_map.go +++ b/container/gmap/gmap_hash_int_int_map.go @@ -7,7 +7,7 @@ package gmap import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "github.com/gogf/gf/internal/empty" diff --git a/container/gmap/gmap_hash_int_str_map.go b/container/gmap/gmap_hash_int_str_map.go index ec9b2017a..9d131054e 100644 --- a/container/gmap/gmap_hash_int_str_map.go +++ b/container/gmap/gmap_hash_int_str_map.go @@ -7,7 +7,7 @@ package gmap import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/internal/empty" diff --git a/container/gmap/gmap_hash_str_any_map.go b/container/gmap/gmap_hash_str_any_map.go index b5cd53ba1..b58cc356f 100644 --- a/container/gmap/gmap_hash_str_any_map.go +++ b/container/gmap/gmap_hash_str_any_map.go @@ -8,7 +8,7 @@ package gmap import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/internal/empty" diff --git a/container/gmap/gmap_hash_str_int_map.go b/container/gmap/gmap_hash_str_int_map.go index f48a4d847..1716b055f 100644 --- a/container/gmap/gmap_hash_str_int_map.go +++ b/container/gmap/gmap_hash_str_int_map.go @@ -8,7 +8,7 @@ package gmap import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/internal/empty" "github.com/gogf/gf/internal/rwmutex" diff --git a/container/gmap/gmap_hash_str_str_map.go b/container/gmap/gmap_hash_str_str_map.go index 2cdc88328..c6922eae6 100644 --- a/container/gmap/gmap_hash_str_str_map.go +++ b/container/gmap/gmap_hash_str_str_map.go @@ -8,7 +8,7 @@ package gmap import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "github.com/gogf/gf/internal/empty" diff --git a/container/gmap/gmap_list_map.go b/container/gmap/gmap_list_map.go index 0e6f5f6de..7e24ed7ad 100644 --- a/container/gmap/gmap_list_map.go +++ b/container/gmap/gmap_list_map.go @@ -7,7 +7,7 @@ package gmap import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/internal/empty" diff --git a/container/gmap/gmap_z_unit_any_any_test.go b/container/gmap/gmap_z_unit_any_any_test.go index 5418959a8..53cc0bfb5 100644 --- a/container/gmap/gmap_z_unit_any_any_test.go +++ b/container/gmap/gmap_z_unit_any_any_test.go @@ -7,10 +7,10 @@ package gmap_test import ( - "encoding/json" "github.com/gogf/gf/container/garray" "github.com/gogf/gf/container/gmap" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/test/gtest" "github.com/gogf/gf/util/gconv" "testing" diff --git a/container/gmap/gmap_z_unit_int_any_test.go b/container/gmap/gmap_z_unit_int_any_test.go index 125596992..cc7f8e57f 100644 --- a/container/gmap/gmap_z_unit_int_any_test.go +++ b/container/gmap/gmap_z_unit_int_any_test.go @@ -7,9 +7,9 @@ package gmap_test import ( - "encoding/json" "github.com/gogf/gf/container/garray" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "testing" diff --git a/container/gmap/gmap_z_unit_int_int_test.go b/container/gmap/gmap_z_unit_int_int_test.go index ae7092c14..f4763be3a 100644 --- a/container/gmap/gmap_z_unit_int_int_test.go +++ b/container/gmap/gmap_z_unit_int_int_test.go @@ -7,9 +7,9 @@ package gmap_test import ( - "encoding/json" "github.com/gogf/gf/container/garray" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "testing" diff --git a/container/gmap/gmap_z_unit_int_str_test.go b/container/gmap/gmap_z_unit_int_str_test.go index 1312684ea..45f4d0bb9 100644 --- a/container/gmap/gmap_z_unit_int_str_test.go +++ b/container/gmap/gmap_z_unit_int_str_test.go @@ -7,9 +7,9 @@ package gmap_test import ( - "encoding/json" "github.com/gogf/gf/container/garray" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "testing" diff --git a/container/gmap/gmap_z_unit_list_map_test.go b/container/gmap/gmap_z_unit_list_map_test.go index 564321c1c..08f60d7e5 100644 --- a/container/gmap/gmap_z_unit_list_map_test.go +++ b/container/gmap/gmap_z_unit_list_map_test.go @@ -7,8 +7,8 @@ package gmap_test import ( - "encoding/json" "github.com/gogf/gf/container/garray" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "testing" diff --git a/container/gmap/gmap_z_unit_str_any_test.go b/container/gmap/gmap_z_unit_str_any_test.go index a2159a38c..7f915a90a 100644 --- a/container/gmap/gmap_z_unit_str_any_test.go +++ b/container/gmap/gmap_z_unit_str_any_test.go @@ -7,9 +7,9 @@ package gmap_test import ( - "encoding/json" "github.com/gogf/gf/container/garray" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "testing" diff --git a/container/gmap/gmap_z_unit_str_int_test.go b/container/gmap/gmap_z_unit_str_int_test.go index 22a87e94f..b806292c2 100644 --- a/container/gmap/gmap_z_unit_str_int_test.go +++ b/container/gmap/gmap_z_unit_str_int_test.go @@ -7,9 +7,9 @@ package gmap_test import ( - "encoding/json" "github.com/gogf/gf/container/garray" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "testing" diff --git a/container/gmap/gmap_z_unit_str_str_test.go b/container/gmap/gmap_z_unit_str_str_test.go index d452b1648..002ae13bc 100644 --- a/container/gmap/gmap_z_unit_str_str_test.go +++ b/container/gmap/gmap_z_unit_str_str_test.go @@ -7,9 +7,9 @@ package gmap_test import ( - "encoding/json" "github.com/gogf/gf/container/garray" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "testing" diff --git a/container/gmap/gmap_z_unit_tree_map_test.go b/container/gmap/gmap_z_unit_tree_map_test.go index 611482d31..bcdec51b6 100644 --- a/container/gmap/gmap_z_unit_tree_map_test.go +++ b/container/gmap/gmap_z_unit_tree_map_test.go @@ -7,8 +7,8 @@ package gmap_test import ( - "encoding/json" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "testing" diff --git a/container/gset/gset_any_set.go b/container/gset/gset_any_set.go index d3191010e..77b339bea 100644 --- a/container/gset/gset_any_set.go +++ b/container/gset/gset_any_set.go @@ -9,7 +9,7 @@ package gset import ( "bytes" - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/internal/rwmutex" "github.com/gogf/gf/text/gstr" "github.com/gogf/gf/util/gconv" diff --git a/container/gset/gset_int_set.go b/container/gset/gset_int_set.go index 55060c6e4..6d006bfa2 100644 --- a/container/gset/gset_int_set.go +++ b/container/gset/gset_int_set.go @@ -9,7 +9,7 @@ package gset import ( "bytes" - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/internal/rwmutex" "github.com/gogf/gf/util/gconv" ) diff --git a/container/gset/gset_str_set.go b/container/gset/gset_str_set.go index 843052798..23a8dd32f 100644 --- a/container/gset/gset_str_set.go +++ b/container/gset/gset_str_set.go @@ -9,7 +9,7 @@ package gset import ( "bytes" - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/internal/rwmutex" "github.com/gogf/gf/text/gstr" "github.com/gogf/gf/util/gconv" diff --git a/container/gset/gset_z_unit_any_test.go b/container/gset/gset_z_unit_any_test.go index be07afe65..50fa0417a 100644 --- a/container/gset/gset_z_unit_any_test.go +++ b/container/gset/gset_z_unit_any_test.go @@ -9,8 +9,8 @@ package gset_test import ( - "encoding/json" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "strings" "sync" diff --git a/container/gset/gset_z_unit_int_test.go b/container/gset/gset_z_unit_int_test.go index 19dffc46a..4ba7ad449 100644 --- a/container/gset/gset_z_unit_int_test.go +++ b/container/gset/gset_z_unit_int_test.go @@ -9,8 +9,8 @@ package gset_test import ( - "encoding/json" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "strings" "sync" diff --git a/container/gset/gset_z_unit_str_test.go b/container/gset/gset_z_unit_str_test.go index 66976d63b..c283b8cdd 100644 --- a/container/gset/gset_z_unit_str_test.go +++ b/container/gset/gset_z_unit_str_test.go @@ -9,8 +9,8 @@ package gset_test import ( - "encoding/json" "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "strings" "sync" diff --git a/container/gtree/gtree_avltree.go b/container/gtree/gtree_avltree.go index 48b0efb2f..5dc35af57 100644 --- a/container/gtree/gtree_avltree.go +++ b/container/gtree/gtree_avltree.go @@ -7,8 +7,8 @@ package gtree import ( - "encoding/json" "fmt" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" diff --git a/container/gtree/gtree_btree.go b/container/gtree/gtree_btree.go index 33e4e219b..ccc1f50dd 100644 --- a/container/gtree/gtree_btree.go +++ b/container/gtree/gtree_btree.go @@ -8,8 +8,8 @@ package gtree import ( "bytes" - "encoding/json" "fmt" + "github.com/gogf/gf/internal/json" "strings" "github.com/gogf/gf/util/gconv" diff --git a/container/gtree/gtree_redblacktree.go b/container/gtree/gtree_redblacktree.go index 343d05221..59906286c 100644 --- a/container/gtree/gtree_redblacktree.go +++ b/container/gtree/gtree_redblacktree.go @@ -7,8 +7,8 @@ package gtree import ( - "encoding/json" "fmt" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "github.com/gogf/gf/util/gutil" diff --git a/container/gtype/interface.go b/container/gtype/interface.go index c912f2657..0c9734e3f 100644 --- a/container/gtype/interface.go +++ b/container/gtype/interface.go @@ -7,7 +7,7 @@ package gtype import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "sync/atomic" ) diff --git a/container/gtype/z_bench_json_test.go b/container/gtype/z_bench_json_test.go index db43ae7db..c4eeefeb5 100644 --- a/container/gtype/z_bench_json_test.go +++ b/container/gtype/z_bench_json_test.go @@ -9,8 +9,8 @@ package gtype_test import ( - "encoding/json" "github.com/gogf/gf/container/gtype" + "github.com/gogf/gf/internal/json" "testing" ) diff --git a/container/gtype/z_unit_bool_test.go b/container/gtype/z_unit_bool_test.go index fdbeee1a5..858868140 100644 --- a/container/gtype/z_unit_bool_test.go +++ b/container/gtype/z_unit_bool_test.go @@ -7,7 +7,7 @@ package gtype_test import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "testing" diff --git a/container/gtype/z_unit_byte_test.go b/container/gtype/z_unit_byte_test.go index 7fb814108..ce171432a 100644 --- a/container/gtype/z_unit_byte_test.go +++ b/container/gtype/z_unit_byte_test.go @@ -7,7 +7,7 @@ package gtype_test import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "sync" "testing" diff --git a/container/gtype/z_unit_bytes_test.go b/container/gtype/z_unit_bytes_test.go index 95230be3a..b0be15489 100644 --- a/container/gtype/z_unit_bytes_test.go +++ b/container/gtype/z_unit_bytes_test.go @@ -7,7 +7,7 @@ package gtype_test import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "testing" diff --git a/container/gtype/z_unit_float32_test.go b/container/gtype/z_unit_float32_test.go index 82489d4c5..fb88f01ae 100644 --- a/container/gtype/z_unit_float32_test.go +++ b/container/gtype/z_unit_float32_test.go @@ -7,8 +7,8 @@ package gtype_test import ( - "encoding/json" "github.com/gogf/gf/container/gtype" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/test/gtest" "github.com/gogf/gf/util/gconv" "math" diff --git a/container/gtype/z_unit_float64_test.go b/container/gtype/z_unit_float64_test.go index cf3832ab9..12079cb5c 100644 --- a/container/gtype/z_unit_float64_test.go +++ b/container/gtype/z_unit_float64_test.go @@ -7,8 +7,8 @@ package gtype_test import ( - "encoding/json" "github.com/gogf/gf/container/gtype" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/test/gtest" "github.com/gogf/gf/util/gconv" "math" diff --git a/container/gtype/z_unit_int32_test.go b/container/gtype/z_unit_int32_test.go index c9b59b2b8..53c268c7f 100644 --- a/container/gtype/z_unit_int32_test.go +++ b/container/gtype/z_unit_int32_test.go @@ -7,8 +7,8 @@ package gtype_test import ( - "encoding/json" "github.com/gogf/gf/container/gtype" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/test/gtest" "github.com/gogf/gf/util/gconv" "math" diff --git a/container/gtype/z_unit_int64_test.go b/container/gtype/z_unit_int64_test.go index 275191f95..21110b8bf 100644 --- a/container/gtype/z_unit_int64_test.go +++ b/container/gtype/z_unit_int64_test.go @@ -7,8 +7,8 @@ package gtype_test import ( - "encoding/json" "github.com/gogf/gf/container/gtype" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/test/gtest" "github.com/gogf/gf/util/gconv" "math" diff --git a/container/gtype/z_unit_int_test.go b/container/gtype/z_unit_int_test.go index 0df4fa5b8..eccdffbd3 100644 --- a/container/gtype/z_unit_int_test.go +++ b/container/gtype/z_unit_int_test.go @@ -7,8 +7,8 @@ package gtype_test import ( - "encoding/json" "github.com/gogf/gf/container/gtype" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/test/gtest" "github.com/gogf/gf/util/gconv" "sync" diff --git a/container/gtype/z_unit_interface_test.go b/container/gtype/z_unit_interface_test.go index fac63aa66..05e124a79 100644 --- a/container/gtype/z_unit_interface_test.go +++ b/container/gtype/z_unit_interface_test.go @@ -7,8 +7,8 @@ package gtype_test import ( - "encoding/json" "github.com/gogf/gf/container/gtype" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/test/gtest" "github.com/gogf/gf/util/gconv" "testing" diff --git a/container/gtype/z_unit_string_test.go b/container/gtype/z_unit_string_test.go index 1dbd455b9..bb1362a6a 100644 --- a/container/gtype/z_unit_string_test.go +++ b/container/gtype/z_unit_string_test.go @@ -7,8 +7,8 @@ package gtype_test import ( - "encoding/json" "github.com/gogf/gf/container/gtype" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/test/gtest" "github.com/gogf/gf/util/gconv" "testing" diff --git a/container/gtype/z_unit_uint32_test.go b/container/gtype/z_unit_uint32_test.go index 9ea1483b0..650d4a97c 100644 --- a/container/gtype/z_unit_uint32_test.go +++ b/container/gtype/z_unit_uint32_test.go @@ -7,8 +7,8 @@ package gtype_test import ( - "encoding/json" "github.com/gogf/gf/container/gtype" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/test/gtest" "github.com/gogf/gf/util/gconv" "math" diff --git a/container/gtype/z_unit_uint64_test.go b/container/gtype/z_unit_uint64_test.go index 5e65b3bd9..a4e5c02a7 100644 --- a/container/gtype/z_unit_uint64_test.go +++ b/container/gtype/z_unit_uint64_test.go @@ -7,7 +7,7 @@ package gtype_test import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "math" "sync" diff --git a/container/gtype/z_unit_uint_test.go b/container/gtype/z_unit_uint_test.go index a5984ee73..5524031c4 100644 --- a/container/gtype/z_unit_uint_test.go +++ b/container/gtype/z_unit_uint_test.go @@ -7,8 +7,8 @@ package gtype_test import ( - "encoding/json" "github.com/gogf/gf/container/gtype" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/test/gtest" "github.com/gogf/gf/util/gconv" "sync" diff --git a/container/gvar/gvar_imp.go b/container/gvar/gvar_imp.go index 31783de39..58408bc19 100644 --- a/container/gvar/gvar_imp.go +++ b/container/gvar/gvar_imp.go @@ -7,7 +7,7 @@ package gvar import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "time" "github.com/gogf/gf/internal/empty" diff --git a/container/gvar/gvar_z_unit_json_test.go b/container/gvar/gvar_z_unit_json_test.go index f05251136..d027461ab 100644 --- a/container/gvar/gvar_z_unit_json_test.go +++ b/container/gvar/gvar_z_unit_json_test.go @@ -7,8 +7,8 @@ package gvar_test import ( - "encoding/json" "github.com/gogf/gf/container/gvar" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/test/gtest" "math" "testing" diff --git a/database/gdb/gdb_z_mysql_join_test.go b/database/gdb/gdb_z_mysql_join_test.go index da70728e0..22790d4a9 100644 --- a/database/gdb/gdb_z_mysql_join_test.go +++ b/database/gdb/gdb_z_mysql_join_test.go @@ -14,6 +14,7 @@ import ( "github.com/gogf/gf/test/gtest" ) +// TODO func Test_Table_Join(t *testing.T) { var ( tableUser = "user_" + gtime.TimestampMicroStr() @@ -22,7 +23,7 @@ func Test_Table_Join(t *testing.T) { if _, err := db.Exec(fmt.Sprintf(` CREATE TABLE %s ( uid int(10) unsigned NOT NULL AUTO_INCREMENT, - name varchar(45) NOT NULL COMMENT, + name varchar(45) NOT NULL, PRIMARY KEY (uid) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; `, tableUser)); err != nil { @@ -33,7 +34,7 @@ CREATE TABLE %s ( if _, err := db.Exec(fmt.Sprintf(` CREATE TABLE %s ( uid int(10) unsigned NOT NULL AUTO_INCREMENT, - name varchar(45) NOT NULL COMMENT, + name varchar(45) NOT NULL, PRIMARY KEY (uid) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; `, tableUserDetail)); err != nil { @@ -54,6 +55,5 @@ CREATE TABLE %s ( User *EntityUser UserDetail *EntityUserDetail } - }) } diff --git a/database/gredis/gredis_conn.go b/database/gredis/gredis_conn.go index bb4b34944..724ba783f 100644 --- a/database/gredis/gredis_conn.go +++ b/database/gredis/gredis_conn.go @@ -7,8 +7,8 @@ package gredis import ( - "encoding/json" "github.com/gogf/gf/container/gvar" + "github.com/gogf/gf/internal/json" "reflect" ) diff --git a/encoding/gini/gini.go b/encoding/gini/gini.go index ec3309a1f..e9c7db20e 100644 --- a/encoding/gini/gini.go +++ b/encoding/gini/gini.go @@ -10,9 +10,9 @@ package gini import ( "bufio" "bytes" - "encoding/json" "errors" "fmt" + "github.com/gogf/gf/internal/json" "io" "strings" ) diff --git a/encoding/gjson/gjson_api_encoding.go b/encoding/gjson/gjson_api_encoding.go index 870c25738..dd8bb5d87 100644 --- a/encoding/gjson/gjson_api_encoding.go +++ b/encoding/gjson/gjson_api_encoding.go @@ -7,11 +7,11 @@ package gjson import ( - "encoding/json" "github.com/gogf/gf/encoding/gini" "github.com/gogf/gf/encoding/gtoml" "github.com/gogf/gf/encoding/gxml" "github.com/gogf/gf/encoding/gyaml" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" ) diff --git a/encoding/gjson/gjson_api_new_load.go b/encoding/gjson/gjson_api_new_load.go index ba7a0a0c9..ecd737a6a 100644 --- a/encoding/gjson/gjson_api_new_load.go +++ b/encoding/gjson/gjson_api_new_load.go @@ -8,9 +8,9 @@ package gjson import ( "bytes" - "encoding/json" "errors" "fmt" + "github.com/gogf/gf/internal/json" "reflect" "github.com/gogf/gf/encoding/gini" diff --git a/encoding/gjson/gjson_stdlib_json_util.go b/encoding/gjson/gjson_stdlib_json_util.go index 9ca18cbe1..c7ebc0bd1 100644 --- a/encoding/gjson/gjson_stdlib_json_util.go +++ b/encoding/gjson/gjson_stdlib_json_util.go @@ -8,7 +8,7 @@ package gjson import ( "bytes" - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" ) diff --git a/encoding/gjson/gjson_z_unit_basic_test.go b/encoding/gjson/gjson_z_unit_basic_test.go index aa50f777e..2de9ebf5a 100644 --- a/encoding/gjson/gjson_z_unit_basic_test.go +++ b/encoding/gjson/gjson_z_unit_basic_test.go @@ -246,7 +246,7 @@ func Test_Append(t *testing.T) { func TestJson_ToJson(t *testing.T) { gtest.C(t, func(t *gtest.T) { - p := gjson.New("1") + p := gjson.New(1) s, e := p.ToJsonString() t.Assert(e, nil) t.Assert(s, "1") diff --git a/encoding/gjson/gjson_z_unit_implements_test.go b/encoding/gjson/gjson_z_unit_implements_test.go index 6969bec10..7f1601098 100644 --- a/encoding/gjson/gjson_z_unit_implements_test.go +++ b/encoding/gjson/gjson_z_unit_implements_test.go @@ -7,7 +7,7 @@ package gjson_test import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "testing" diff --git a/encoding/gtoml/gtoml.go b/encoding/gtoml/gtoml.go index e72ca7cd6..3d4a7887d 100644 --- a/encoding/gtoml/gtoml.go +++ b/encoding/gtoml/gtoml.go @@ -9,7 +9,7 @@ package gtoml import ( "bytes" - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/BurntSushi/toml" ) diff --git a/encoding/gyaml/gyaml.go b/encoding/gyaml/gyaml.go index feaeb6798..587eba319 100644 --- a/encoding/gyaml/gyaml.go +++ b/encoding/gyaml/gyaml.go @@ -8,7 +8,7 @@ package gyaml import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "gopkg.in/yaml.v3" "github.com/gogf/gf/util/gconv" diff --git a/encoding/gyaml/gyaml_test.go b/encoding/gyaml/gyaml_test.go index 384ae4df3..e63267c73 100644 --- a/encoding/gyaml/gyaml_test.go +++ b/encoding/gyaml/gyaml_test.go @@ -7,7 +7,7 @@ package gyaml_test import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "testing" "github.com/gogf/gf/encoding/gparser" diff --git a/go.mod b/go.mod index 95770705f..086c9ef1f 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( github.com/gorilla/websocket v1.4.1 github.com/gqcn/structs v1.1.1 github.com/grokify/html-strip-tags-go v0.0.0-20190921062105-daaa06bf1aaf + github.com/json-iterator/go v1.1.10 github.com/mattn/go-runewidth v0.0.9 // indirect github.com/olekukonko/tablewriter v0.0.1 golang.org/x/sys v0.0.0-20200610111108-226ff32320da // indirect diff --git a/internal/json/json.go b/internal/json/json.go new file mode 100644 index 000000000..f6bf0da53 --- /dev/null +++ b/internal/json/json.go @@ -0,0 +1,69 @@ +// Copyright 2020 gf Author(https://github.com/gogf/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://github.com/gogf/gf. + +// Package json provides json operations wrapping ignoring stdlib or third-party lib json. +package json + +import ( + json2 "encoding/json" + "github.com/json-iterator/go" + "io" +) + +// ConfigCompatibleWithStandardLibrary tries to be 90% compatible +// with standard library behavior. +var json = jsoniter.ConfigCompatibleWithStandardLibrary + +// Marshal adapts to json/encoding Marshal API. +// +// Marshal returns the JSON encoding of v, adapts to json/encoding Marshal API +// Refer to https://godoc.org/encoding/json#Marshal for more information. +func Marshal(v interface{}) ([]byte, error) { + return json.Marshal(v) +} + +// MarshalToString convenient method to write as string instead of []byte. +func MarshalToString(v interface{}) (string, error) { + return json.MarshalToString(v) +} + +// MarshalIndent same as json.MarshalIndent. Prefix is not supported. +func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { + return json2.MarshalIndent(v, prefix, indent) +} + +// UnmarshalFromString is a convenient method to read from string instead of []byte. +func UnmarshalFromString(str string, v interface{}) error { + return json.UnmarshalFromString(str, v) +} + +// Unmarshal adapts to json/encoding Unmarshal API +// +// Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. +// Refer to https://godoc.org/encoding/json#Unmarshal for more information. +func Unmarshal(data []byte, v interface{}) error { + return json.Unmarshal(data, v) +} + +// NewEncoder same as json.NewEncoder +func NewEncoder(writer io.Writer) *jsoniter.Encoder { + return json.NewEncoder(writer) +} + +// NewDecoder adapts to json/stream NewDecoder API. +// +// NewDecoder returns a new decoder that reads from r. +// +// 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) +} + +// Valid reports whether data is a valid JSON encoding. +func Valid(data []byte) bool { + return json.Valid(data) +} diff --git a/net/ghttp/ghttp_client_request.go b/net/ghttp/ghttp_client_request.go index 043db2f43..eb6e6d78b 100644 --- a/net/ghttp/ghttp_client_request.go +++ b/net/ghttp/ghttp_client_request.go @@ -8,9 +8,9 @@ package ghttp import ( "bytes" - "encoding/json" "errors" "fmt" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/internal/utils" "io" "io/ioutil" diff --git a/net/ghttp/ghttp_request_param.go b/net/ghttp/ghttp_request_param.go index 201bcdc57..b24ae93ab 100644 --- a/net/ghttp/ghttp_request_param.go +++ b/net/ghttp/ghttp_request_param.go @@ -8,12 +8,12 @@ package ghttp import ( "bytes" - "encoding/json" "fmt" "github.com/gogf/gf/container/gvar" "github.com/gogf/gf/encoding/gjson" "github.com/gogf/gf/encoding/gurl" "github.com/gogf/gf/encoding/gxml" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/internal/utils" "github.com/gogf/gf/text/gregex" "github.com/gogf/gf/text/gstr" diff --git a/net/ghttp/ghttp_response_write.go b/net/ghttp/ghttp_response_write.go index 5e6a0cb0a..ab6e5aedf 100644 --- a/net/ghttp/ghttp_response_write.go +++ b/net/ghttp/ghttp_response_write.go @@ -8,8 +8,8 @@ package ghttp import ( - "encoding/json" "fmt" + "github.com/gogf/gf/internal/json" "net/http" "github.com/gogf/gf/encoding/gparser" diff --git a/net/ghttp/ghttp_server_router_serve.go b/net/ghttp/ghttp_server_router_serve.go index 0ad031eba..720fe8cfe 100644 --- a/net/ghttp/ghttp_server_router_serve.go +++ b/net/ghttp/ghttp_server_router_serve.go @@ -7,8 +7,8 @@ package ghttp import ( - "encoding/json" "fmt" + "github.com/gogf/gf/internal/json" "strings" "github.com/gogf/gf/container/glist" diff --git a/net/ghttp/ghttp_unit_param_json_test.go b/net/ghttp/ghttp_unit_param_json_test.go index 0435be4ad..98e231a0d 100644 --- a/net/ghttp/ghttp_unit_param_json_test.go +++ b/net/ghttp/ghttp_unit_param_json_test.go @@ -7,8 +7,8 @@ package ghttp_test import ( - "encoding/json" "fmt" + "github.com/gogf/gf/internal/json" "testing" "time" diff --git a/os/gbuild/gbuild.go b/os/gbuild/gbuild.go index 13b2809bc..13a8b89e5 100644 --- a/os/gbuild/gbuild.go +++ b/os/gbuild/gbuild.go @@ -8,11 +8,11 @@ package gbuild import ( - "encoding/json" "github.com/gogf/gf" "github.com/gogf/gf/container/gvar" "github.com/gogf/gf/encoding/gbase64" "github.com/gogf/gf/internal/intlog" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "runtime" ) diff --git a/os/gcmd/gcmd_parser.go b/os/gcmd/gcmd_parser.go index d66a7fc6a..f02d8b996 100644 --- a/os/gcmd/gcmd_parser.go +++ b/os/gcmd/gcmd_parser.go @@ -8,8 +8,8 @@ package gcmd import ( - "encoding/json" "fmt" + "github.com/gogf/gf/internal/json" "os" "strings" diff --git a/os/gproc/gproc_comm_receive.go b/os/gproc/gproc_comm_receive.go index 35f34511b..c101fe0f0 100644 --- a/os/gproc/gproc_comm_receive.go +++ b/os/gproc/gproc_comm_receive.go @@ -7,8 +7,8 @@ package gproc import ( - "encoding/json" "fmt" + "github.com/gogf/gf/internal/json" "net" "github.com/gogf/gf/container/gqueue" diff --git a/os/gproc/gproc_comm_send.go b/os/gproc/gproc_comm_send.go index 48bbc7e36..74b947c5e 100644 --- a/os/gproc/gproc_comm_send.go +++ b/os/gproc/gproc_comm_send.go @@ -7,8 +7,8 @@ package gproc import ( - "encoding/json" "errors" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/net/gtcp" "io" ) diff --git a/os/gres/gres_file.go b/os/gres/gres_file.go index 208641593..dd2f2ccb7 100644 --- a/os/gres/gres_file.go +++ b/os/gres/gres_file.go @@ -9,7 +9,7 @@ package gres import ( "archive/zip" "bytes" - "encoding/json" + "github.com/gogf/gf/internal/json" "io" "os" ) diff --git a/os/gsession/gsession_storage_file.go b/os/gsession/gsession_storage_file.go index 979f681e1..5a4a4a247 100644 --- a/os/gsession/gsession_storage_file.go +++ b/os/gsession/gsession_storage_file.go @@ -7,10 +7,10 @@ package gsession import ( - "encoding/json" "fmt" "github.com/gogf/gf/container/gmap" "github.com/gogf/gf/internal/intlog" + "github.com/gogf/gf/internal/json" "os" "time" diff --git a/os/gsession/gsession_storage_redis.go b/os/gsession/gsession_storage_redis.go index 5cb36976d..545be8024 100644 --- a/os/gsession/gsession_storage_redis.go +++ b/os/gsession/gsession_storage_redis.go @@ -7,10 +7,10 @@ package gsession import ( - "encoding/json" "github.com/gogf/gf/container/gmap" "github.com/gogf/gf/database/gredis" "github.com/gogf/gf/internal/intlog" + "github.com/gogf/gf/internal/json" "time" "github.com/gogf/gf/os/gtimer" diff --git a/os/gtime/gtime_z_unit_json_test.go b/os/gtime/gtime_z_unit_json_test.go index 0c5c07592..80654db71 100644 --- a/os/gtime/gtime_z_unit_json_test.go +++ b/os/gtime/gtime_z_unit_json_test.go @@ -7,7 +7,7 @@ package gtime_test import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/os/gtime" "github.com/gogf/gf/test/gtest" "testing" diff --git a/other/test.go b/other/test.go new file mode 100644 index 000000000..302827a4c --- /dev/null +++ b/other/test.go @@ -0,0 +1,17 @@ +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)) +} diff --git a/util/gconv/gconv.go b/util/gconv/gconv.go index a07992c4d..06a89210e 100644 --- a/util/gconv/gconv.go +++ b/util/gconv/gconv.go @@ -10,9 +10,9 @@ package gconv import ( - "encoding/json" "fmt" "github.com/gogf/gf/internal/intstore" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/os/gtime" "reflect" "strconv" diff --git a/util/gconv/gconv_map.go b/util/gconv/gconv_map.go index 328e96651..830d6bd02 100644 --- a/util/gconv/gconv_map.go +++ b/util/gconv/gconv_map.go @@ -7,9 +7,9 @@ package gconv import ( - "encoding/json" "errors" "github.com/gogf/gf/errors/gerror" + "github.com/gogf/gf/internal/json" "reflect" "strings" diff --git a/util/gconv/gconv_slice.go b/util/gconv/gconv_slice.go index 56ca67f30..f7eed76f1 100644 --- a/util/gconv/gconv_slice.go +++ b/util/gconv/gconv_slice.go @@ -7,10 +7,10 @@ package gconv import ( - "encoding/json" "errors" "fmt" "github.com/gogf/gf/errors/gerror" + "github.com/gogf/gf/internal/json" "reflect" ) diff --git a/util/gconv/gconv_z_unit_struct_test.go b/util/gconv/gconv_z_unit_struct_test.go index f08360913..956259db5 100644 --- a/util/gconv/gconv_z_unit_struct_test.go +++ b/util/gconv/gconv_z_unit_struct_test.go @@ -7,7 +7,7 @@ package gconv_test import ( - "encoding/json" + "github.com/gogf/gf/internal/json" "testing" "time" diff --git a/util/gutil/gutil_dump.go b/util/gutil/gutil_dump.go index 708cd5c32..e8f5f2185 100644 --- a/util/gutil/gutil_dump.go +++ b/util/gutil/gutil_dump.go @@ -8,8 +8,8 @@ package gutil import ( "bytes" - "encoding/json" "fmt" + "github.com/gogf/gf/internal/json" "github.com/gogf/gf/util/gconv" "os" "reflect"