json

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt

type Opt[T any] struct {
	// contains filtered or unexported fields
}

func (*Opt[T]) Decoded

func (o *Opt[T]) Decoded() bool

func (*Opt[T]) OrDefault

func (o *Opt[T]) OrDefault(def T) T

func (*Opt[T]) UnmarshalJSON

func (o *Opt[T]) UnmarshalJSON(data []byte) error

func (*Opt[T]) Value

func (o *Opt[T]) Value() (T, bool)

type Strings

type Strings []string

Strings decodes JSON stirng or array of strings or `null` into Go slice of string:

  • If JSON value is an array of string, it's decoded directly into Go slice: ["one", "two", "three"] -> ["one", "tho", "three"]
  • JSON string value decoded into singleton Go slice: "Helllo" -> ["Hello"]
  • JSON `null` value decoded into an empty slice: null -> []

func (*Strings) UnmarshalJSON

func (s *Strings) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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