json

package
v1.3.20 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: Zlib Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefMarshal = &Marshal{}
View Source
var DefUnmarshal = &Unmarshal{}

Functions

func DumpBytes added in v1.2.10

func DumpBytes(obj interface{}, options ...DumpOption) ([]byte, error)

DumpBytes convert Go data object to JSON []byte

func DumpString added in v1.2.10

func DumpString(obj interface{}, options ...DumpOption) (string, error)

DumpString encode Go data object to JSON string

func MarshalString added in v1.0.56

func MarshalString(o interface{}) string

MarshalString 序列化参数

func MustDumpBytes added in v1.2.10

func MustDumpBytes(obj interface{}, options ...DumpOption) []byte

MustDumpBytes encode Go data object to JSON []byte (panic in case of error)

func MustDumpString added in v1.2.10

func MustDumpString(obj interface{}, options ...DumpOption) string

MustDumpString encode Go data object to JSON string (panic in case of error)

func Read added in v0.1.2

func Read(name string, v interface{}) error

func UnquoteBytes added in v1.2.3

func UnquoteBytes(s []byte) (t []byte, ok bool)

Types

type DumpOption added in v1.2.10

type DumpOption func(enc *json.Encoder)

func EscapeHTML added in v1.2.10

func EscapeHTML(escape bool) DumpOption

func Indent added in v1.2.10

func Indent(s string) DumpOption

Indent sets the indentation level (passed as string of spaces) for DumpBytes/DumpString

type Marshal added in v0.1.2

type Marshal struct {
}

func (*Marshal) Marshal added in v1.0.56

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

type Unmarshal added in v1.0.56

type Unmarshal struct {
}

func (*Unmarshal) Unmarshal added in v1.0.56

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

Jump to

Keyboard shortcuts

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