We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 01d2ef8 commit e1c7161Copy full SHA for e1c7161
CHANGELOG.md
@@ -1,5 +1,9 @@
1
# vNext
2
3
+# v1.3.2
4
+
5
+- (feature) Add validate mehtod to custom json un/marshall functions
6
7
# v1.3.1
8
9
- (feature) Add custom json un-/marshall functions
json/valid.go
@@ -0,0 +1,22 @@
+package json
+import (
+ stdjson "encoding/json"
+ "runtime"
+ "github.com/Becklyn/go-wire-core/env"
+ "github.com/bytedance/sonic"
+ "github.com/goccy/go-json"
10
+)
11
12
+func Valid(data []byte) bool {
13
+ if env.StringWithDefault("JSON_ENCODER", "std") == "std" {
14
+ return stdjson.Valid(data)
15
+ }
16
17
+ if runtime.GOARCH == "amd64" {
18
+ return sonic.Valid(data)
19
20
21
+ return json.Valid(data)
22
+}
0 commit comments