json

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 2 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CodecHandle *codec.JsonHandle

CodecHandle is used to instantiate JSON encoders and decoders with our settings (canonical, paranoid about decoding errors)

View Source
var JSONStrictHandle *codec.JsonHandle

JSONStrictHandle is the same as CodecHandle but with MapKeyAsString=true for correct maps[int]interface{} encoding

View Source
var LenientCodecHandle *codec.JsonHandle

LenientCodecHandle is used to instantiate msgpack encoders for the REST API.

Functions

func Decode

func Decode(b []byte, objptr interface{}) error

Decode attempts to decode a json-encoded byte buffer into an object instance pointed to by objptr

func Encode

func Encode(obj interface{}) []byte

Encode returns a json-encoded byte buffer for a given object

func EncodeStrict added in v2.1.0

func EncodeStrict(obj interface{}) []byte

EncodeStrict returns a JSON-encoded byte buffer for a given object It is the same Encode but encodes map's int keys as strings

func LenientDecode

func LenientDecode(b []byte, objptr interface{}) error

LenientDecode attempts to decode a json-encoded byte buffer into an object instance pointed to by objptr

func NewDecoder

func NewDecoder(r io.Reader) *codec.Decoder

NewDecoder returns a json decoder

func NewLenientDecoder

func NewLenientDecoder(r io.Reader) *codec.Decoder

NewLenientDecoder returns a json decoder

Types

This section is empty.

Jump to

Keyboard shortcuts

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