Documentation
¶
Overview ¶
Package jsonmember reads JSON documents member by member, by each member's JSON kind (RFC 8259).
Object decodes with encoding/json/v2 at its defaults, which refuses duplicate names and invalid UTF-8 at every depth, unread members included, and bounds the nesting (RFC 8259 §4, §8.1). A member is then read by its kind, never by decoding into a Go type, since json/v2 decodes null into a string, number or bool as the zero value with no error. So a null member is the wrong kind; a caller that reads null as absent checks for it itself.
Index ¶
- func Array(v jsontext.Value) (vals []jsontext.Value, ok bool)
- func Bool(v jsontext.Value) (b, ok bool)
- func NumericDate(v jsontext.Value) (t time.Time, ok bool)
- func Object(data []byte) (map[string]jsontext.Value, error)
- func String(v jsontext.Value) (s string, ok bool)
- func Strings(v jsontext.Value) ([]string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NumericDate ¶
NumericDate reads v as a NumericDate (RFC 7519 §2): a JSON number of seconds since the epoch, in [0, maxNumericDate], its fraction dropped. ok is false for any other value, null and a string included.
func Object ¶
Object decodes data as one JSON object, its members' values kept as JSON text. Any other document, null included, is an error.
Types ¶
This section is empty.