Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder interface {
// PeekKind returns the Kind of the next token without consuming it.
PeekKind() Kind
// ReadToken reads the next token and returns its string value, kind, and error.
ReadToken() (token string, _ Kind, _ error)
// ReadValue reads the next value, which may be a complete JSON
// node (object, array, or scalar), as bytes.
ReadValue() (value []byte, _ error)
// SkipValue skips the next value (maybe a complete JSON node).
SkipValue() error
}
Decoder defines a streaming JSON decoder interface.
Only the lowest level interface is preserved, higher level requires some shallow encapsulation.
type Encoder ¶
type Encoder interface {
// WriteValue writes a JSON value to the encoder.
WriteValue(v []byte) error
}
Encoder defines a streaming JSON encoder interface.
Only the lowest level interface is preserved, higher level requires some shallow encapsulation.
type Kind ¶
type Kind byte
Kind represents each possible JSON token kind with a single byte, which is conveniently the first byte of that kind's grammar with the restriction that numbers always be represented with '0':
- 'n': null
- 'f': false
- 't': true
- '"': string
- '0': number
- '{': object begin
- '}': object end
- '[': array begin
- ']': array end
An invalid kind is usually represented using 0, but may be non-zero due to invalid JSON data.
const InvalidKind Kind = 0
Click to show internal directories.
Click to hide internal directories.