Documentation
¶
Index ¶
- Constants
- Variables
- func MarshalBase64(v any) (string, error)
- func MarshalFile(filename string, v any, prefix, indent string, perm fs.FileMode) error
- func MarshalOrDefault(v any, def []byte) ([]byte, error)
- func MarshalSimple(v any, prefix, indent string) ([]byte, error)
- func MarshalSlice(v ...any) ([]byte, error)
- func MustMarshal(v any, embedError bool) []byte
- func MustMarshalIndent(v any, prefix, indent string, embedError bool) []byte
- func MustMarshalOrDefault(v any, def []byte) []byte
- func MustMarshalSimple(v any, prefix, indent string) []byte
- func MustMarshalString(v any, embedError bool) string
- func MustUnmarshal(b []byte, v any)
- func SHA512d256Base32(v any, padding rune) (string, error)
- func UnmarshalAny(data, v any) error
- func UnmarshalFile(filename string, v any) error
- func UnmarshalFileWithBytes(filename string, v any) ([]byte, error)
- func UnmarshalMSI(data map[string]any, v any) error
- func UnmarshalReader(r io.Reader, v any) ([]byte, error)
- func UnmarshalStrict(b []byte, v any) error
- func UnmarshalWithLoc(data []byte, v any) error
- func ValidateQuick(b []byte, fuzzy bool) bool
- type Bool
- type Int64
- type String
Constants ¶
const ( EmptyArray = "[]" EmptyObject = "{}" FileExt = ".json" )
Variables ¶
var ( MarshalPrefix = "" MarshalIndent = " " )
Functions ¶
func MarshalBase64 ¶
func MarshalFile ¶ added in v0.66.4
func MarshalOrDefault ¶ added in v0.64.9
MarshalOrDefault returns the supplied default value in the event of an error. It also returns the error for processing.
func MarshalSlice ¶ added in v0.67.5
MarshalSlice marshals any slice, using `fmt.Sprintf()` for non-strings.
func MustMarshal ¶
func MustMarshalIndent ¶
func MustMarshalOrDefault ¶ added in v0.64.9
func MustMarshalSimple ¶
func MustMarshalString ¶
func MustUnmarshal ¶ added in v0.37.5
func UnmarshalAny ¶ added in v0.60.0
UnmarshalAny will unmarshal anything to `v`, including first marshalling anything that is not a byte array to a JSON byte array.
func UnmarshalFile ¶ added in v0.63.2
func UnmarshalFileWithBytes ¶ added in v0.66.4
func UnmarshalStrict ¶ added in v0.39.4
UnmarshalStrict returns an error when the destination is a struct and the input contains object keys which do not match any non-ignored, exported fields in the destination.
func UnmarshalWithLoc ¶ added in v0.67.2
func ValidateQuick ¶ added in v0.68.0
ValidateQuick checks to see if the first and last bytes match `{}[]`. Set `fuzzy` to true to trim spaces from the beginning and end. It is not Design to provide full validation but quick decision making on whether to attempt JSON parsing.
Types ¶
type Bool ¶
type Bool bool
Bool implements a tolerant reader for `bool` type.
func (*Bool) UnmarshalJSON ¶
type Int64 ¶
type Int64 int64
Int64 implements a tolerant reader for `int64` type.