Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrSyntax = DecoderError{/* contains filtered or unexported fields */} ErrUnexpectedEOF = DecoderError{/* contains filtered or unexported fields */} ErrMaxDepth = 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) MaxDepth ¶
MaxDepth will set the maximum recursion depth. If the maximum depth is exceeded, ErrMaxDepth is returned. Less than or 0 means no limit (default).
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 ¶
type DecoderError struct {
// contains filtered or unexported fields
}
DecoderError contains a detailed decoding error.
func (DecoderError) Error ¶
func (e DecoderError) Error() string
Error returns a string representation of the error.
func (DecoderError) ReaderErr ¶
func (e DecoderError) ReaderErr() error
ReaderErr returns the underlying error.
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.

