jsons

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 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 interface{}) error { return json.Unmarshal(toBytes(buf), val) }
	MarshalString   = func(val interface{}) (string, error) {
		bs, err := json.Marshal(val)
		if err != nil {
			return "", err
		}
		return toString(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.7.8

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

type JsonEncoder added in v0.7.8

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