json

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 4 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

View Source
var G = Options{
	MarshalOptions: MarshalOptions{
		PrefixStr: "",
		IndentStr: "  ",
	},
	UnmarshalOptions: UnmarshalOptions{},
}

Functions

func Compact added in v2.0.15

func Compact(src []byte) ([]byte, error)

func CompactString added in v2.0.15

func CompactString(src string) (string, error)

func Indent added in v2.0.15

func Indent(src []byte) ([]byte, error)

func IndentString added in v2.0.15

func IndentString(src string) (string, error)

func Marshal

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

func MarshalIndent

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

func MarshalIndentString

func MarshalIndentString(v any) (string, error)

func MarshalString

func MarshalString(v any) (string, error)

func MustCompact added in v2.0.15

func MustCompact(src []byte) []byte

func MustCompactString added in v2.0.15

func MustCompactString(src string) string

func MustIndent added in v2.0.15

func MustIndent(src []byte) []byte

func MustIndentString added in v2.0.15

func MustIndentString(src string) string

func MustMarshal

func MustMarshal(v any) []byte

func MustMarshalIndent

func MustMarshalIndent(v any) []byte

func MustMarshalIndentString

func MustMarshalIndentString(v any) string

func MustMarshalString

func MustMarshalString(v any) string

func MustUnmarshal

func MustUnmarshal(bs []byte, v any)

func MustUnmarshalString

func MustUnmarshalString(s string, v any)

func MustUnmarshalTo

func MustUnmarshalTo[T any](a any) T

func Unmarshal

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

func UnmarshalString

func UnmarshalString(s string, v any) error

func UnmarshalTo

func UnmarshalTo[T any](a any) (T, error)

Types

type MarshalOptions

type MarshalOptions struct {
	DisableHTMLEscape    bool
	DisableNormalizeUTF8 bool

	PrefixStr string
	IndentStr string
}

func (MarshalOptions) Compact added in v2.0.15

func (o MarshalOptions) Compact(src []byte) ([]byte, error)

func (MarshalOptions) CompactString added in v2.0.15

func (o MarshalOptions) CompactString(src string) (string, error)

func (MarshalOptions) Indent

func (o MarshalOptions) Indent(src []byte) ([]byte, error)

func (MarshalOptions) IndentString added in v2.0.15

func (o MarshalOptions) IndentString(src string) (string, error)

func (MarshalOptions) Marshal

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

func (MarshalOptions) MarshalIndent

func (o MarshalOptions) MarshalIndent(v any) ([]byte, error)

func (MarshalOptions) MarshalIndentString

func (o MarshalOptions) MarshalIndentString(v any) (string, error)

func (MarshalOptions) MarshalString

func (o MarshalOptions) MarshalString(v any) (string, error)

func (MarshalOptions) MustCompact added in v2.0.15

func (o MarshalOptions) MustCompact(src []byte) []byte

func (MarshalOptions) MustCompactString added in v2.0.15

func (o MarshalOptions) MustCompactString(src string) string

func (MarshalOptions) MustIndent added in v2.0.15

func (o MarshalOptions) MustIndent(src []byte) []byte

func (MarshalOptions) MustIndentString added in v2.0.15

func (o MarshalOptions) MustIndentString(src string) string

func (MarshalOptions) MustMarshal

func (o MarshalOptions) MustMarshal(v any) []byte

func (MarshalOptions) MustMarshalIndent

func (o MarshalOptions) MustMarshalIndent(v any) []byte

func (MarshalOptions) MustMarshalIndentString

func (o MarshalOptions) MustMarshalIndentString(v any) string

func (MarshalOptions) MustMarshalString

func (o MarshalOptions) MustMarshalString(v any) string

type Options

type Options struct {
	MarshalOptions
	UnmarshalOptions
}

type UnmarshalOptions

type UnmarshalOptions struct {
}

func (UnmarshalOptions) MustUnmarshal

func (o UnmarshalOptions) MustUnmarshal(bs []byte, v any)

func (UnmarshalOptions) MustUnmarshalString

func (o UnmarshalOptions) MustUnmarshalString(s string, v any)

func (UnmarshalOptions) Unmarshal

func (o UnmarshalOptions) Unmarshal(bs []byte, v any) error

func (UnmarshalOptions) UnmarshalString

func (o UnmarshalOptions) UnmarshalString(s string, v any) error

Jump to

Keyboard shortcuts

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