mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 19:45:28 +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>
27 lines
811 B
Go
27 lines
811 B
Go
package json
|
|
|
|
// Marshaler is the interface implemented by types that
|
|
// can marshal themselves into valid JSON.
|
|
type Marshaler interface {
|
|
MarshalJSON() ([]byte, error)
|
|
}
|
|
|
|
// Unmarshaler is the interface implemented by types
|
|
// that can unmarshal a JSON description of themselves.
|
|
// The input can be assumed to be a valid encoding of
|
|
// a JSON value. UnmarshalJSON must copy the JSON data
|
|
// if it wishes to retain the data after returning.
|
|
//
|
|
// By convention, to approximate the behavior of [Unmarshal] itself,
|
|
// Unmarshalers implement UnmarshalJSON([]byte("null")) as a no-op.
|
|
type Unmarshaler interface {
|
|
UnmarshalJSON([]byte) error
|
|
}
|
|
|
|
// JSONCodec is the interface implemented by types that can marshal and
|
|
// unmarshal themselves into valid JSON.
|
|
type JSONCodec interface {
|
|
Marshaler
|
|
Unmarshaler
|
|
}
|