From 74df5b75f89ebba019d55adfc3e0b491f0b32323 Mon Sep 17 00:00:00 2001 From: a <a@a.a> Date: Sat, 17 Sep 2022 10:37:29 -0500 Subject: [PATCH] ok --- json.go | 16 ++-------------- wsjson/wsjson.go | 4 +++- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/json.go b/json.go index 5a7f14d..a894887 100644 --- a/json.go +++ b/json.go @@ -28,22 +28,10 @@ import ( "sync" "time" - jsoniter "github.com/json-iterator/go" + "gfx.cafe/open/jrpc/wsjson" ) -var jzon = jsoniter.Config{ - IndentionStep: 0, - MarshalFloatWith6Digits: false, - EscapeHTML: true, - SortMapKeys: false, - UseNumber: false, - DisallowUnknownFields: false, - TagKey: "", - OnlyTaggedField: false, - ValidateJsonRawMessage: false, - ObjectFieldMustBeSimpleString: false, - CaseSensitive: false, -}.Froze() +var jzon = wsjson.JZON const ( vsn = "2.0" diff --git a/wsjson/wsjson.go b/wsjson/wsjson.go index d9fb649..07c72fd 100644 --- a/wsjson/wsjson.go +++ b/wsjson/wsjson.go @@ -18,11 +18,13 @@ var jzon = jsoniter.Config{ DisallowUnknownFields: false, TagKey: "", OnlyTaggedField: false, - ValidateJsonRawMessage: true, + ValidateJsonRawMessage: false, ObjectFieldMustBeSimpleString: false, CaseSensitive: false, }.Froze() +var JZON = jzon + // Read reads a JSON message from c into v. // It will reuse buffers in between calls to avoid allocations. func Read(ctx context.Context, c *websocket.Conn, v interface{}) error { -- GitLab