json

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: Apache-2.0 Imports: 11 Imported by: 281

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(b []byte, vs structform.Visitor) error

func ParseReader

func ParseReader(in io.Reader, vs structform.Visitor) (int64, error)

func ParseString

func ParseString(str string, vs structform.Visitor) error

Types

type Decoder

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

func NewBytesDecoder

func NewBytesDecoder(b []byte, vs structform.Visitor) *Decoder

func NewDecoder

func NewDecoder(in io.Reader, buffer int, vs structform.Visitor) *Decoder

func (*Decoder) Next

func (dec *Decoder) Next() error

type Parser

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

func NewParser

func NewParser(vs structform.Visitor) *Parser

func (*Parser) Parse

func (p *Parser) Parse(b []byte) error

func (*Parser) ParseString

func (p *Parser) ParseString(str string) error

func (*Parser) Write

func (p *Parser) Write(b []byte) (int, error)

type Visitor

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

Visitor implements the structform.Visitor interface, json encoding the structure being visited

func NewVisitor

func NewVisitor(out io.Writer) *Visitor

func (*Visitor) OnArrayFinished

func (vs *Visitor) OnArrayFinished() error

func (*Visitor) OnArrayStart

func (vs *Visitor) OnArrayStart(_ int, _ structform.BaseType) error

func (*Visitor) OnBool

func (vs *Visitor) OnBool(b bool) error

func (*Visitor) OnByte

func (vs *Visitor) OnByte(b byte) error

func (*Visitor) OnFloat32

func (vs *Visitor) OnFloat32(f float32) error

func (*Visitor) OnFloat64

func (vs *Visitor) OnFloat64(f float64) error

func (*Visitor) OnInt

func (vs *Visitor) OnInt(i int) error

func (*Visitor) OnInt16

func (vs *Visitor) OnInt16(i int16) error

func (*Visitor) OnInt32

func (vs *Visitor) OnInt32(i int32) error

func (*Visitor) OnInt64

func (vs *Visitor) OnInt64(i int64) error

func (*Visitor) OnInt8

func (vs *Visitor) OnInt8(i int8) error

func (*Visitor) OnKey

func (vs *Visitor) OnKey(s string) error

func (*Visitor) OnKeyRef

func (vs *Visitor) OnKeyRef(s []byte) error

func (*Visitor) OnNil

func (vs *Visitor) OnNil() error

func (*Visitor) OnObjectFinished

func (vs *Visitor) OnObjectFinished() error

func (*Visitor) OnObjectStart

func (vs *Visitor) OnObjectStart(_ int, _ structform.BaseType) error

func (*Visitor) OnString

func (vs *Visitor) OnString(s string) error

func (*Visitor) OnStringRef

func (vs *Visitor) OnStringRef(s []byte) error

func (*Visitor) OnUint

func (vs *Visitor) OnUint(u uint) error

func (*Visitor) OnUint16

func (vs *Visitor) OnUint16(u uint16) error

func (*Visitor) OnUint32

func (vs *Visitor) OnUint32(u uint32) error

func (*Visitor) OnUint64

func (vs *Visitor) OnUint64(u uint64) error

func (*Visitor) OnUint8

func (vs *Visitor) OnUint8(u uint8) error

func (*Visitor) SetEscapeHTML added in v0.0.4

func (v *Visitor) SetEscapeHTML(b bool)

func (*Visitor) SetIgnoreInvalidFloat added in v0.0.8

func (v *Visitor) SetIgnoreInvalidFloat(b bool)

SetIgnoreInvalidFloat configures how the visitor handles undefined floating point values like NaN or Inf. By default the visitor will error. This behavior is similar to setting SetIgnoreInvalidFloat(false). If true is passed, then invalid floating point values will be replaces with the `null` symbol.

Jump to

Keyboard shortcuts

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