Documentation ¶
Index ¶
Constants ¶
const ( // ObjectStart indicates the start of JSON object. ObjectStart = '{' // { // ObjectEnd is the end of the JSON object. ObjectEnd = '}' // } // String is the start of JSON string. String = '"' // " // Colon indicates that the token is an object value. Colon = ':' // : // Comma indicates the next JSON element. Comma = ',' // , // ArrayStart is the start of JSON array. ArrayStart = '[' // [ // ArrayEnd is the end of JSON array. ArrayEnd = ']' // ] // True is 'true' token. True = 't' // t // False is 'false'. False = 'f' // f // Null is 'null' token. Null = 'n' // n )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
A Decoder decodes JSON values from an input stream.
func MakeDecoder ¶
MakeDecoder returns decoder for the input data
func (*Decoder) NextToken ¶
NextToken returns a []byte referencing the next logical token in the stream. The []byte is valid until Token is called again. At the end of the input stream, Token returns nil, io.EOF.
Token guarantees that the delimiters [ ] { } it returns are properly nested and matched: if Token encounters an unexpected delimiter in the input, it will return an error.
A valid token begins with one of the following:
{ Object start [ Array start } Object end ] Array End t JSON true f JSON false n JSON null " A string, possibly containing backslash escaped entites. -, 0-9 A number
Commas and colons are elided.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner implements a JSON scanner as defined in RFC 7159.
func (*Scanner) Next ¶
Next returns a []byte referencing the next lexical token in the stream. The []byte is valid until Next is called again. If the stream is at its end, or an error has occured, Next returns a zero length []byte slice.
A valid token begins with one of the following:
{ Object start [ Array start } Object end ] Array End , Literal comma : Literal colon t JSON true f JSON false n JSON null " A string, possibly containing backslash escaped entites. -, 0-9 A number