diff --git a/glide.yaml b/glide.yaml index 8d495b7..12cdd12 100644 --- a/glide.yaml +++ b/glide.yaml @@ -6,3 +6,5 @@ import: - package: gopkg.in/natefinch/npipe.v2 - package: git.loafle.net/commons_go/websocket_fasthttp - package: git.loafle.net/commons_go/util +- package: github.com/json-iterator/go + version: 1.1.3 diff --git a/protocol/json/client.go b/protocol/json/client.go index 3ead2d6..63dfb3c 100644 --- a/protocol/json/client.go +++ b/protocol/json/client.go @@ -1,13 +1,15 @@ package json import ( - "encoding/json" "io" "git.loafle.net/commons_go/rpc/codec" "git.loafle.net/commons_go/rpc/protocol" + jsoniter "github.com/json-iterator/go" ) +var json = jsoniter.ConfigCompatibleWithStandardLibrary + // ---------------------------------------------------------------------------- // Codec // ---------------------------------------------------------------------------- diff --git a/protocol/json/client_notification.go b/protocol/json/client_notification.go index 0c96da2..0065a85 100644 --- a/protocol/json/client_notification.go +++ b/protocol/json/client_notification.go @@ -1,13 +1,14 @@ package json import ( - "encoding/json" - "git.loafle.net/commons_go/rpc/codec" crp "git.loafle.net/commons_go/rpc/protocol" cuej "git.loafle.net/commons_go/util/encoding/json" + jsoniter "github.com/json-iterator/go" ) +var json = jsoniter.ConfigCompatibleWithStandardLibrary + // ---------------------------------------------------------------------------- // ClientNotificationCodec // ---------------------------------------------------------------------------- diff --git a/protocol/json/client_response.go b/protocol/json/client_response.go index 6a2d59b..130c365 100644 --- a/protocol/json/client_response.go +++ b/protocol/json/client_response.go @@ -1,15 +1,17 @@ package json import ( - "encoding/json" "fmt" "io" "git.loafle.net/commons_go/rpc/codec" "git.loafle.net/commons_go/rpc/protocol" crp "git.loafle.net/commons_go/rpc/protocol" + jsoniter "github.com/json-iterator/go" ) +var json = jsoniter.ConfigCompatibleWithStandardLibrary + // ---------------------------------------------------------------------------- // ClientResponseCodec // ---------------------------------------------------------------------------- diff --git a/protocol/json/server.go b/protocol/json/server.go index cbc38f9..78d259e 100644 --- a/protocol/json/server.go +++ b/protocol/json/server.go @@ -1,13 +1,15 @@ package json import ( - "encoding/json" "io" "git.loafle.net/commons_go/rpc/codec" "git.loafle.net/commons_go/rpc/protocol" + jsoniter "github.com/json-iterator/go" ) +var json = jsoniter.ConfigCompatibleWithStandardLibrary + var null = json.RawMessage([]byte("null")) // ---------------------------------------------------------------------------- diff --git a/protocol/json/server_request.go b/protocol/json/server_request.go index 9f0d955..865f443 100644 --- a/protocol/json/server_request.go +++ b/protocol/json/server_request.go @@ -1,15 +1,17 @@ package json import ( - "encoding/json" "io" "git.loafle.net/commons_go/rpc/codec" "git.loafle.net/commons_go/rpc/protocol" crp "git.loafle.net/commons_go/rpc/protocol" cuej "git.loafle.net/commons_go/util/encoding/json" + jsoniter "github.com/json-iterator/go" ) +var json = jsoniter.ConfigCompatibleWithStandardLibrary + // ---------------------------------------------------------------------------- // Request // ---------------------------------------------------------------------------- diff --git a/protocol/json/util.go b/protocol/json/util.go index 43695d1..dd20139 100644 --- a/protocol/json/util.go +++ b/protocol/json/util.go @@ -1,13 +1,16 @@ package json import ( - "encoding/json" "fmt" "reflect" + jsoniter "github.com/json-iterator/go" + cur "git.loafle.net/commons_go/util/reflect" ) +var json = jsoniter.ConfigCompatibleWithStandardLibrary + func convertParamsToStringArray(params []interface{}) ([]string, error) { var values []string if nil == params || 0 == len(params) {