You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
406 B

package jx
// Null reads a json object as null and
// returns whether it's a null or not.
func (d *Decoder) Null() error {
if err := d.skipSpace(); err != nil {
return err
}
var buf [4]byte
if err := d.readExact4(&buf); err != nil {
return err
}
if string(buf[:]) != "null" {
const encodedNull = 'n' | 'u'<<8 | 'l'<<16 | 'l'<<24
return findInvalidToken4(buf, encodedNull)
}
return nil
}