json

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes added in v0.9.0

func Bytes(value any) ([]byte, error)

func Decode

func Decode(dec Decoder, target any) error

func Encode

func Encode(enc Encoder, value any) error

func Parse added in v0.1.12

func Parse[T any](data []byte) (T, error)

func ParseInto added in v0.9.0

func ParseInto(data []byte, target any) error

func ParseString added in v0.1.12

func ParseString[T any](data string) (T, error)

func ParseStringInto added in v0.9.0

func ParseStringInto(data string, target any) error

func Pretty added in v0.9.0

func Pretty(s string) string

func PrettyBytes added in v0.9.0

func PrettyBytes(value any) ([]byte, error)

func Read added in v0.9.0

func Read[T any](reader io.Reader) (T, error)

func ReadInto added in v0.9.0

func ReadInto(reader io.Reader, target any) error

func Write added in v0.9.0

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

func WriteOutput

func WriteOutput(v any) error

Types

type Array added in v0.17.3

type Array struct {
	Items []JSONValue
}

type Bool added in v0.17.3

type Bool struct {
	Value bool
}

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder(reader io.Reader) Decoder

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder(writer io.Writer) Encoder

func WithIndent

func WithIndent(enc Encoder, indent string) Encoder

func WithPrefix

func WithPrefix(enc Encoder, prefix string) Encoder

type Frozen added in v0.19.6

type Frozen struct {
	Canonical string
}

func ParseFrozen added in v0.19.6

func ParseFrozen(data []byte) (Frozen, error)

func ParseStringFrozen added in v0.19.6

func ParseStringFrozen(data string) (Frozen, error)

func (Frozen) String added in v0.19.6

func (f Frozen) String() string

func (Frozen) Thaw added in v0.19.6

func (f Frozen) Thaw() JSONValue

type JSONValue added in v0.17.3

type JSONValue interface {
	// contains filtered or unexported methods
}

func ParseStringValue added in v0.17.3

func ParseStringValue(data string) (JSONValue, error)

func ParseValue added in v0.17.3

func ParseValue(data []byte) (JSONValue, error)

func ReadValue added in v0.17.3

func ReadValue(reader io.Reader) (JSONValue, error)

type Null added in v0.17.3

type Null struct{}

type Num added in v0.17.3

type Num struct {
	Value float64
}

type Number added in v0.9.0

type Number = json.Number

type Object added in v0.17.3

type Object struct {
	Fields map[string]JSONValue
}

type Str added in v0.17.3

type Str struct {
	Value string
}

Jump to

Keyboard shortcuts

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