json

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 3 Imported by: 11

Documentation

Overview

Package json contains the encoding/json en/de-coder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodecJSON

type CodecJSON struct{}

CodecJSON implements the codecs.Marshal interface, and can be used for marshaling CodecJSON config files, and web requests.

func (*CodecJSON) ContentTypes

func (j *CodecJSON) ContentTypes() []string

ContentTypes returns the content types the marshaler can handle.

func (*CodecJSON) Decode

func (j *CodecJSON) Decode(data []byte, v any) error

Decode decodes json bytes into object v. Param v should be a pointer type.

func (*CodecJSON) Decodes

func (j *CodecJSON) Decodes(_ any) bool

Decodes returns if this is able to decode the given type.

func (*CodecJSON) Encode

func (j *CodecJSON) Encode(v any) ([]byte, error)

Encode marshals any object into json bytes. Param v should be a pointer type.

func (*CodecJSON) Encodes

func (j *CodecJSON) Encodes(_ any) bool

Encodes returns if this is able to encode the given type.

func (*CodecJSON) Exts

func (j *CodecJSON) Exts() []string

Exts is a list of file extensions this marshaler supports.

func (*CodecJSON) NewDecoder

func (j *CodecJSON) NewDecoder(r io.Reader) codecs.Decoder

NewDecoder returns a new JSON decoder.

func (*CodecJSON) NewEncoder

func (j *CodecJSON) NewEncoder(w io.Writer) codecs.Encoder

NewEncoder returns a new JSON encoder.

func (*CodecJSON) String

func (j *CodecJSON) String() string

String returns the plugin implementation of the marshaler.

Jump to

Keyboard shortcuts

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