json

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: AGPL-3.0 Imports: 6 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidJSON

func IsValidJSON(b []byte) bool

Types

type Duration

type Duration struct {
	time.Duration
}

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

UnmarshalJSON fulfills the encoding/json.Unmarshaler interface. It attempts to parse text as a time.Duration string. The Go documentation defines this as a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"). If there is no time unit, UnmarshalJSON defaults to ms.

type HexBytes

type HexBytes []byte

func (HexBytes) MarshalText

func (h HexBytes) MarshalText() ([]byte, error)

func (*HexBytes) UnmarshalText

func (h *HexBytes) UnmarshalText(text []byte) error

type Map

type Map []byte

func (Map) MarshalJSON

func (m Map) MarshalJSON() ([]byte, error)

func (*Map) UnmarshalJSON

func (m *Map) UnmarshalJSON(text []byte) error

Jump to

Keyboard shortcuts

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