Documentation ¶
Index ¶
- func Parse(b []byte, vs structform.Visitor) error
- func ParseReader(in io.Reader, vs structform.Visitor) (int64, error)
- func ParseString(str string, vs structform.Visitor) error
- type Decoder
- type Parser
- type Visitor
- func (vs *Visitor) OnArrayFinished() error
- func (vs *Visitor) OnArrayStart(_ int, _ structform.BaseType) error
- func (vs *Visitor) OnBool(b bool) error
- func (vs *Visitor) OnByte(b byte) error
- func (vs *Visitor) OnFloat32(f float32) error
- func (vs *Visitor) OnFloat64(f float64) error
- func (vs *Visitor) OnInt(i int) error
- func (vs *Visitor) OnInt16(i int16) error
- func (vs *Visitor) OnInt32(i int32) error
- func (vs *Visitor) OnInt64(i int64) error
- func (vs *Visitor) OnInt8(i int8) error
- func (vs *Visitor) OnKey(s string) error
- func (vs *Visitor) OnKeyRef(s []byte) error
- func (vs *Visitor) OnNil() error
- func (vs *Visitor) OnObjectFinished() error
- func (vs *Visitor) OnObjectStart(_ int, _ structform.BaseType) error
- func (vs *Visitor) OnString(s string) error
- func (vs *Visitor) OnStringRef(s []byte) error
- func (vs *Visitor) OnUint(u uint) error
- func (vs *Visitor) OnUint16(u uint16) error
- func (vs *Visitor) OnUint32(u uint32) error
- func (vs *Visitor) OnUint64(u uint64) error
- func (vs *Visitor) OnUint8(u uint8) error
- func (v *Visitor) SetEscapeHTML(b bool)
- func (v *Visitor) SetExplicitRadixPoint(b bool)
- func (v *Visitor) SetIgnoreInvalidFloat(b bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseReader ¶
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 ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func NewParser ¶
func NewParser(vs structform.Visitor) *Parser
func (*Parser) ParseString ¶
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 (*Visitor) OnArrayFinished ¶
func (*Visitor) OnArrayStart ¶
func (vs *Visitor) OnArrayStart(_ int, _ structform.BaseType) error
func (*Visitor) OnObjectFinished ¶
func (*Visitor) OnObjectStart ¶
func (vs *Visitor) OnObjectStart(_ int, _ structform.BaseType) error
func (*Visitor) OnStringRef ¶
func (*Visitor) SetEscapeHTML ¶ added in v0.0.4
func (*Visitor) SetExplicitRadixPoint ¶ added in v0.0.12
SetExplicitRadixPoint configures whether the visitor encodes floating point values with an explicit radix point. By default, equiv to SetExplicitRadixPoint(false), the radix point will be skipped if it is not needed. e.g. 1.0 to 1 instead of 1.0, 100000000 to 1e+8 instead of 1.0e+8. If true is passed, the encoded number will always contain a radix point, in either decimal form or scientific notation. This may be useful to signal the type of the number to a json parser.
func (*Visitor) SetIgnoreInvalidFloat ¶ added in v0.0.8
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.