Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeNumber ¶
DecodeNumber will attempt to decode data in the format of a JSON numer from the reader. JSON is somewhat ambiguous about numbers: we'll return an int if we can, and a float if there's any decimal point involved. The boolean return indicates which kind of number we have: if true, we have an int (and the float return is invalid); if false, we have a float (and the int return is invalid).
func DecodeString ¶
DecodeString will attempt to decode data in the format of a JSON string from the reader. If the first byte read is not `"`, it is not a string at all, and an error is returned. Any other parse errors of json strings also result in error.
func DecodeStringBody ¶
DecodeStringBody will attempt to decode data in the format of a JSON string from the reader, except it assumes that the leading `"` has already been consumed, and will similarly leave the trailing `"` unread (although it will check for its presence).
Implementation note: you'll find that this method is used in the Decoder's implementation, while DecodeString is actually not. This is because when doing a whole document parse, the leading `"` is always already consumed because it's how we discovered it's time to parse a string.
Types ¶
type Decoder ¶
type Decoder struct { DecoderConfig // contains filtered or unexported fields }