Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrSyntax = DecoderError{/* contains filtered or unexported fields */} ErrUnexpectedEOF = DecoderError{/* contains filtered or unexported fields */} )
Predefined errors
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder wraps an io.Reader to provide incremental decoding of JSON values
func NewDecoder ¶
NewDecoder creates new Decoder to read JSON values at the provided emitDepth from the provider io.Reader. If emitDepth is < 0, values at every depth will be emitted.
func (*Decoder) EmitKV ¶
EmitKV enables emitting a jstream.KV struct when the items(s) parsed at configured emit depth are within a JSON object. By default, only the object values are emitted.
func (*Decoder) ObjectAsKVS ¶
ObjectAsKVS - by default JSON returns map[string]interface{} this is usually fine in most cases, but when you need to preserve the input order its not a right data structure. To preserve input order please use this option.
type DecoderError ¶ added in v1.0.1
type DecoderError struct {
// contains filtered or unexported fields
}
func (DecoderError) Error ¶ added in v1.0.1
func (e DecoderError) Error() string
func (DecoderError) ReaderErr ¶ added in v1.0.1
func (e DecoderError) ReaderErr() error
type KV ¶
type KV struct { Key string `json:"key"` Value interface{} `json:"value"` }
KV contains a key and value pair parsed from a decoded object
type KVS ¶
type KVS []KV
KVS - represents key values in an JSON object
func (KVS) MarshalJSON ¶
MarshalJSON - implements converting a KVS datastructure into a JSON object with multiple keys and values.