mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 01:45:26 +00:00
* perf(*): replace `encoding/json` w/ sonic Signed-off-by: Dwi Siswanto <git@dw1.io> * feat(utils): add `json` pkg (sonic wrapper) Signed-off-by: Dwi Siswanto <git@dw1.io> * chore(*): use `sonic` wrapper instead Signed-off-by: Dwi Siswanto <git@dw1.io> * chore(*): replace `sonic.ConfigStd` -> `json` (wrapper) Signed-off-by: Dwi Siswanto <git@dw1.io> * test(model): adjust expected marshal'd JSON Signed-off-by: Dwi Siswanto <git@dw1.io> * feat(json): dynamic backend; `sonic` -> `go-json` (fallback) Signed-off-by: Dwi Siswanto <git@dw1.io> * chore(json): merge config - as its not usable Signed-off-by: Dwi Siswanto <git@dw1.io> * chore(json): rm go version constraints Signed-off-by: Dwi Siswanto <git@dw1.io> * chore: go mod tidy Signed-off-by: Dwi Siswanto <git@dw1.io> --------- Signed-off-by: Dwi Siswanto <git@dw1.io>
30 lines
645 B
Go
30 lines
645 B
Go
//go:build (linux || darwin || windows) && (amd64 || arm64)
|
|
// +build linux darwin windows
|
|
// +build amd64 arm64
|
|
|
|
package json
|
|
|
|
import "github.com/bytedance/sonic"
|
|
|
|
var api = sonic.ConfigStd
|
|
|
|
// Exported functions from the [sonic.API].
|
|
var (
|
|
Marshal = api.Marshal
|
|
Unmarshal = api.Unmarshal
|
|
MarshalIndent = api.MarshalIndent
|
|
NewDecoder = api.NewDecoder
|
|
NewEncoder = api.NewEncoder
|
|
)
|
|
|
|
// Encoder is a JSON encoder.
|
|
type Encoder = sonic.Encoder
|
|
|
|
// Decoder is a JSON decoder.
|
|
type Decoder = sonic.Decoder
|
|
|
|
// SetConfig sets the configuration for the JSON package.
|
|
func SetConfig(config *sonic.Config) {
|
|
api = config.Froze()
|
|
}
|