jsonx

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: BSD-3-Clause Imports: 4 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IndentEncoderFunc = func(w io.Writer) iox.Encoder {
	e := json.NewEncoder(w)
	e.SetIndent("", "\t")
	return e
}

IndentEncoderFunc is a iox.EncoderFunc that sets indentation

Functions

func Open

func Open(v any, filename string) error

Open reads the given object from the given filename using JSON encoding

func OpenFS

func OpenFS(v any, fsys fs.FS, filename string) error

OpenFS reads the given object from the given filename using JSON encoding, using the given fs.FS filesystem (e.g., for embed files)

func OpenFiles

func OpenFiles(v any, filenames ...string) error

OpenFiles reads the given object from the given filenames using JSON encoding

func OpenFilesFS

func OpenFilesFS(v any, fsys fs.FS, filenames ...string) error

OpenFilesFS reads the given object from the given filenames using JSON encoding, using the given fs.FS filesystem (e.g., for embed files)

func Read

func Read(v any, reader io.Reader) error

Read reads the given object from the given reader, using JSON encoding

func ReadBytes

func ReadBytes(v any, data []byte) error

ReadBytes reads the given object from the given bytes, using JSON encoding

func Save

func Save(v any, filename string) error

Save writes the given object to the given filename using JSON encoding

func SaveIndent

func SaveIndent(v any, filename string) error

SaveIndent writes the given object to the given filename using JSON encoding, with indentation

func Write

func Write(v any, writer io.Writer) error

Write writes the given object using JSON encoding

func WriteBytes

func WriteBytes(v any) ([]byte, error)

WriteBytes writes the given object, returning bytes of the encoding, using JSON encoding

func WriteBytesIndent

func WriteBytesIndent(v any) ([]byte, error)

WriteBytesIndent writes the given object, returning bytes of the encoding, using JSON encoding, with indentation

func WriteIndent

func WriteIndent(v any, writer io.Writer) error

WriteIndent writes the given object using JSON encoding, with indentation

Types

This section is empty.

Jump to

Keyboard shortcuts

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