 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- func Marshal(v interface{}) ([]byte, error)
- func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error)
- func SetEngine(marshal, unmarshal Engine)
- func SetEngineFromEnv()
- func SetMarshalEngine(engine Engine)
- func SetUnmarshalEngine(engine Engine)
- func Unmarshal(data []byte, v interface{}) error
- type Decoder
- type Encoder
- type Engine
Constants ¶
      View Source
      
  const ( EngineStandard = "std" EngineGoJson = "gojson" EngineJsoniter = "jsoniter" EngineSonic = "sonic" )
Constants for JSON engine names.
Variables ¶
This section is empty.
Functions ¶
func MarshalIndent ¶
MarshalIndent serializes the input with indentation using the marshal engine.
func SetEngineFromEnv ¶
func SetEngineFromEnv()
func SetMarshalEngine ¶
func SetMarshalEngine(engine Engine)
func SetUnmarshalEngine ¶
func SetUnmarshalEngine(engine Engine)
Types ¶
type Decoder ¶
type Decoder interface {
	Decode(v interface{}) error
}
    func NewDecoder ¶
NewDecoder returns a new decoder using the unmarshal engine.
type Encoder ¶
type Encoder interface {
	Encode(v interface{}) error
}
    func NewEncoder ¶
NewEncoder returns a new encoder using the marshal engine.
type Engine ¶
type Engine interface {
	Marshal(v interface{}) ([]byte, error)
	Unmarshal(data []byte, v interface{}) error
	MarshalIndent(v interface{}, prefix, indent string) ([]byte, error)
	NewEncoder(w io.Writer) Encoder
	NewDecoder(r io.Reader) Decoder
}
    Engine defines the base interface for JSON operations.
func GetEngineByName ¶
func NewGoJsonEngine ¶
func NewGoJsonEngine() Engine
func NewJsoniterEngine ¶
func NewJsoniterEngine() Engine
func NewSonicEngine ¶
func NewSonicEngine() Engine
func NewStdEngine ¶
func NewStdEngine() Engine
 Click to show internal directories. 
   Click to hide internal directories.