json

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Helper

type Helper interface {
	Marshal(v interface{}) ([]byte, error)
	Unmarshal(data []byte, v interface{}) error
}

Helper is an interface for JSON helper.

type JSON

type JSON struct {
	// contains filtered or unexported fields
}

JSON is a wrapper for JSON helper.

func NewJSON

func NewJSON(json Helper) *JSON

NewJSON returns a new JSON.

func (*JSON) Marshal

func (j *JSON) Marshal(v interface{}) ([]byte, error)

Marshal marshals the given value to JSON.

func (*JSON) Unmarshal

func (j *JSON) Unmarshal(data []byte, v interface{}) error

Unmarshal unmarshals the given JSON to the given value.

type NativeJSON

type NativeJSON struct{}

NativeJSON is a wrapper for encoding/json.

func (*NativeJSON) Marshal

func (*NativeJSON) Marshal(v interface{}) ([]byte, error)

Marshal marshals the given value to JSON.

func (*NativeJSON) Unmarshal

func (*NativeJSON) Unmarshal(data []byte, v interface{}) error

Unmarshal unmarshals the given JSON to the given value.

type SonicJSON

type SonicJSON struct{}

SonicJSON is a wrapper for bytedance/sonic.

func (*SonicJSON) Marshal

func (*SonicJSON) Marshal(v interface{}) ([]byte, error)

Marshal marshals the given value to JSON.

func (*SonicJSON) Unmarshal

func (*SonicJSON) Unmarshal(data []byte, v interface{}) error

Unmarshal unmarshals the given JSON to the given value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL