json

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FlattenAudience uint32

FlattenAudience is a flag to specify if we should flatten the "aud" entry to a string when there's only one entry. In jwx < 1.1.8 we just dumped everything as an array of strings, but apparently AWS Cognito doesn't handle this well.

So now we have the ability to dump "aud" as a string if there's only one entry, but we need to retain the old behavior so that we don't accidentally break somebody else's code. (e.g. messing up how signatures are calculated)

Functions

func AssignNextBytesToken

func AssignNextBytesToken(dst *[]byte, dec *Decoder) error

func AssignNextStringToken

func AssignNextStringToken(dst **string, dec *Decoder) error

func DecoderSettings

func DecoderSettings(inUseNumber bool)

Sets the global configuration for json decoding

func Dump

func Dump(v interface{})

func EncodeAudience

func EncodeAudience(enc *Encoder, aud []string) error

func Engine

func Engine() string

func Marshal

func Marshal(v interface{}) ([]byte, error)

Marshal is just a proxy for "encoding/json".Marshal

func MarshalIndent

func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error)

MarshalIndent is just a proxy for "encoding/json".MarshalIndent

func NewDecoder

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

NewDecoder respects the values specified in DecoderSettings, and creates a Decoder that has certain features turned on/off

func NewEncoder

func NewEncoder(w io.Writer) *json.Encoder

func ReadNextStringToken

func ReadNextStringToken(dec *Decoder) (string, error)

func Unmarshal

func Unmarshal(b []byte, v interface{}) error

Unmarshal respects the values specified in DecoderSettings, and uses a Decoder that has certain features turned on/off

Types

type DecodeCtx

type DecodeCtx interface {
	Registry() *Registry
}

DecodeCtx is an interface for objects that needs that extra something when decoding JSON into an object.

func NewDecodeCtx

func NewDecodeCtx(r *Registry) DecodeCtx

type DecodeCtxContainer

type DecodeCtxContainer interface {
	DecodeCtx() DecodeCtx
	SetDecodeCtx(DecodeCtx)
}

DecodeCtxContainer is used to differentiate objects that can carry extra decoding hints and those who can't.

type Decoder

type Decoder = json.Decoder

type Delim

type Delim = json.Delim

type Encoder

type Encoder = json.Encoder

type Marshaler

type Marshaler = json.Marshaler

type Number

type Number = json.Number

type RawMessage

type RawMessage = json.RawMessage

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Decode

func (r *Registry) Decode(dec *Decoder, name string) (interface{}, error)

func (*Registry) Register

func (r *Registry) Register(name string, object interface{})

type Unmarshaler

type Unmarshaler = json.Unmarshaler

Jump to

Keyboard shortcuts

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