json

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package json provides a document Encoder and Decoder implementation that is used to implement Smithy document types for JSON based protocols. The Encoder and Decoder implement the document.Marshaler and document.Unmarshaler interfaces respectively.

This package handles protocol specific implementation details about documents, and can not be used to construct a document type for a service client. To construct a document type see each service clients respective document package and NewLazyDocument function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

Decoder is a Smithy document decoder for JSON based protocols.

func NewDecoder

func NewDecoder(optFns ...func(*DecoderOptions)) *Decoder

NewDecoder returns a Decoder for deserializing Smithy documents for JSON based protocols.

func (*Decoder) DecodeJSONInterface

func (d *Decoder) DecodeJSONInterface(input interface{}, toValue interface{}) error

DecodeJSONInterface decodes the supported JSON input types and stores the result in the value pointed by toValue.

If toValue is not a compatible type, or an error occurs while decoding DecodeJSONInterface will return an error.

The supported input JSON types are:

bool -> JSON boolean
float64 -> JSON number
json.Number -> JSON number
string -> JSON string
[]interface{} -> JSON array
map[string]interface{} -> JSON object
nil -> JSON null

type DecoderOptions

type DecoderOptions struct{}

DecoderOptions is the set of options that can be configured for a Decoder.

type Encoder

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

Encoder is a Smithy document decoder for JSON based protocols.

func NewEncoder

func NewEncoder(optFns ...func(options *EncoderOptions)) *Encoder

NewEncoder returns an Encoder for serializing Smithy documents for JSON based protocols.

func (*Encoder) Encode

func (e *Encoder) Encode(v interface{}) ([]byte, error)

Encode returns the JSON encoding of v.

type EncoderOptions

type EncoderOptions struct{}

EncoderOptions is the set of options that can be configured for an Encoder.

Jump to

Keyboard shortcuts

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