json

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2025 License: GPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder struct{}

Decoder struct

func NewDecoder

func NewDecoder() *Decoder

NewDecoder creates a new JSON decoder

Returns:

  • *Decoder: The default decoder

func (Decoder) Decode

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

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

type StreamDecoder

type StreamDecoder struct{}

StreamDecoder is the JSON decoder struct

func NewStreamDecoder

func NewStreamDecoder() *StreamDecoder

NewStreamDecoder creates a new JSON decoder

Returns:

  • *StreamDecoder: The default decoder

func (StreamDecoder) Decode

func (s StreamDecoder) 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 (StreamDecoder) DecodeReader

func (s StreamDecoder) DecodeReader(
	reader io.Reader,
	dest any,
) error

DecodeReader decodes a JSON body from a reader into a destination

Parameters:

  • reader: The reader to read the body from
  • 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