jsons

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Unmarshal     = json.Unmarshal
	Marshal       = json.Marshal
	MarshalIndent = json.MarshalIndent

	UnmarshalString = func(buf string, val any) error { return Unmarshal(string2Bytes(buf), val) }
	MarshalString   = func(val any) (string, error) {
		bs, err := Marshal(val)
		if err != nil {
			return "", err
		}
		return bytes2String(bs), nil
	}

	NewEncoder = func(w io.Writer) JSONEncoder {
		return json.NewEncoder(w)
	}
	NewDecoder = func(r io.Reader) JSONDecoder {
		return json.NewDecoder(r)
	}
)

Functions

This section is empty.

Types

type JSONDecoder added in v0.10.0

type JSONDecoder interface {
	Decode(v any) error
	UseNumber()
	DisallowUnknownFields()
	Buffered() io.Reader
	More() bool
}

type JSONEncoder added in v0.10.0

type JSONEncoder interface {
	Encode(v any) error
	SetIndent(prefix, indent string)
	SetEscapeHTML(on bool)
}

Jump to

Keyboard shortcuts

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