jsonx

package
v1.60.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 3 Imported by: 91

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeGeneric

func DecodeGeneric(data []byte) (any, error)

DecodeGeneric decodes the given JSON as a generic map or slice

func Marshal

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

Marshal marshals the given object to JSON

func MarshalMerged

func MarshalMerged(v1 any, v2 any) ([]byte, error)

MarshalMerged marshals the properties of two objects as one object

func MarshalPretty

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

MarshalPretty marshals the given object to pretty JSON

func MustMarshal added in v1.11.0

func MustMarshal(v any) []byte

MustMarshal marshals the given object to JSON, panicking on an error

func MustUnmarshal added in v1.11.0

func MustUnmarshal(data []byte, v any)

MustUnmarshal unmarshals the given JSON, panicking on an error

func Unmarshal

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

Unmarshal is just a shortcut for json.Unmarshal so all calls can be made via the jsonx package

func UnmarshalArray

func UnmarshalArray(data []byte) ([]json.RawMessage, error)

UnmarshalArray unmarshals an array of objects from the given JSON

func UnmarshalWithLimit

func UnmarshalWithLimit(reader io.ReadCloser, s any, limit int64) error

UnmarshalWithLimit unmarsmals a struct with a limit on how many bytes can be read from the given reader

Types

This section is empty.

Jump to

Keyboard shortcuts

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