package json

import "github.com/aws/aws-sdk-go-v2/aws/protocol/json"

Index

Types

type Array

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

Array represent the encoding of a JSON Array

func (*Array) Close

func (a *Array) Close()

Close encodes the end of the JSON Array

func (*Array) Value

func (a *Array) Value() Value

Value adds a new element to the JSON Array. Returns a Value type that is used to encode the array element.

type Encoder

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

Encoder is JSON encoder that supports construction of JSON values using methods.

func NewEncoder

func NewEncoder() *Encoder

NewEncoder returns a new JSON encoder

func (Encoder) Bytes

func (e Encoder) Bytes() []byte

Bytes returns the []byte slice of the JSON encoder

func (Encoder) String

func (e Encoder) String() string

String returns the String output of the JSON encoder

type Object

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

Object represents the encoding of a JSON Object type

func (*Object) Close

func (o *Object) Close()

Close encodes the end of the JSON Object

func (*Object) Key

func (o *Object) Key(name string) Value

Key adds the given named key to the JSON object. Returns a Value encoder that should be used to encode a JSON value type.

type Value

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

Value represents a JSON Value type JSON Value types: Object, Array, String, Number, Boolean, and Null

func (Value) Array

func (jv Value) Array() *Array

Array returns a new Array encoder

func (Value) Boolean

func (jv Value) Boolean(v bool)

Boolean encodes v as a JSON boolean

func (Value) ByteSlice

func (jv Value) ByteSlice(v []byte)

ByteSlice encodes v as a base64 value in JSON string

func (Value) Float

func (jv Value) Float(v float64)

Float encodes v as a JSON number

func (Value) Integer

func (jv Value) Integer(v int64)

Integer encodes v as a JSON number

func (Value) Null

func (jv Value) Null()

Null encodes a null JSON value

func (Value) Object

func (jv Value) Object() *Object

Object returns a new Object encoder

func (Value) String

func (jv Value) String(v string)

String encodes v as a JSON string

func (Value) Time

func (jv Value) Time(v time.Time, format string) error

Time encodes v using the provided format specifier as a JSON string

Source Files

array.go constants.go encoder.go escape.go object.go value.go

Version
v0.22.0
Published
Apr 27, 2020
Platform
darwin/amd64
Imports
8 packages
Last checked
2 minutes ago

Tools for package owners.