json

package
v1.20.6 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Zlib Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCoder = &coder{}

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 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, data interface{}) error

func ToString added in v1.4.12

func ToString(o interface{}) string

ToString 序列化参数

func UnQuoteBytes added in v1.6.13

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

func Write added in v1.8.68

func Write(name string, data interface{}, perm os.FileMode) error

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(prefix, indent string) DumpOption

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

Jump to

Keyboard shortcuts

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