...

Package json

import "github.com/aws/smithy-go/document/json"
Overview
Index

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.

type Decoder

Decoder is a Smithy document decoder for JSON based protocols.

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

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

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

type DecoderOptions struct{}

type Encoder

Encoder is a Smithy document decoder for JSON based protocols.

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

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

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

type EncoderOptions struct{}