json

package
v2.1.13 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 4 Imported by: 11 modules, 23 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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