json

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder added in v0.11.2

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

Decoder struct

func NewDecoder added in v0.11.2

func NewDecoder(
	mode *goflagsmode.Flag,
	decoder gojsondecoder.Decoder,
) (*Decoder, error)

NewDecoder creates a new JSON decoder

Parameters:

  • mode: The flag mode
  • decoder: The JSON decoder

Returns:

  • *Decoder: The default decoder
  • error: The error if any

func (Decoder) Decode added in v0.11.2

func (d Decoder) Decode(
	body any,
	dest any,
) error

Decode decodes the JSON body from an any value and stores it in the destination

Parameters:

  • body: The body to decode
  • dest: The destination to store the decoded body

Returns:

  • error: The error if any

func (Decoder) DecodeReader added in v0.12.2

func (d Decoder) DecodeReader(
	reader io.Reader,
	dest any,
) error

DecodeReader decodes the JSON body and stores it in the destination

Parameters:

  • reader: The reader to read the body from
  • dest: The destination to store the decoded body

Returns:

  • error: The error if any

func (Decoder) DecodeRequest added in v0.12.2

func (d Decoder) DecodeRequest(
	r *http.Request,
	dest any,
) error

DecodeRequest decodes the JSON request body and stores it in the destination

Parameters:

  • request: The HTTP request
  • dest: The destination to store the decoded body

Returns:

  • error: The error if any

Jump to

Keyboard shortcuts

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