Documentation
¶
Overview ¶
Package jparser provides helper methods to parse JSON from stream.
Index ¶
- Constants
- func CheckArrayStart(d *json.Decoder, desc string) error
- func CheckEOF(d *json.Decoder) error
- func CheckObjectArrayStart(d *json.Decoder, desc string) (bool, error)
- func CheckObjectStart(d *json.Decoder, desc string) error
- func CheckRootArrayStart(d *json.Decoder) (bool, error)
- func CheckRootObjectStart(d *json.Decoder) (bool, error)
- func GetArray(d *json.Decoder, desc string) ([]interface{}, error)
- func GetBoolean(d *json.Decoder, desc string) (bool, error)
- func GetNumber(d *json.Decoder, desc string) (float64, error)
- func GetString(d *json.Decoder, desc string) (string, error)
- func GetStringSequence(d *json.Decoder, f func(idx int, s string) error, desc string) error
- func GetStringSequenceFromArray(d *json.Decoder, f func(idx int, s string) error, desc string) error
- func GetStringSequenceFromObject(d *json.Decoder, f func(idx int, s string) error, desc string) error
- func GetUndefined(d *json.Decoder, desc string) (interface{}, error)
- func SkipArray(d *json.Decoder, desc string) error
- func SkipObject(d *json.Decoder, desc string) error
- func SkipValue(d *json.Decoder, desc string) error
- func UnmarshalObject(d *json.Decoder, u func(key string, d *json.Decoder) error, desc string) error
- func UnmarshalObjectArray(d *json.Decoder, u func(idx int, d *json.Decoder) error, desc string) error
- type Pair
Constants ¶
const ( // DelimObjectStart contains json object '{' start delimiter. DelimObjectStart = "{" // DelimObjectEnd contains json object '}' start delimiter. DelimObjectEnd = "}" // DelimArrayStart contains json array '[' start delimiter. DelimArrayStart = "[" // DelimArrayEnd contains json array '}' end delimiter. DelimArrayEnd = "]" )
Variables ¶
This section is empty.
Functions ¶
func CheckArrayStart ¶
CheckArrayStart checks whether next token is '[' in JSON byte stream.
func CheckObjectArrayStart ¶
CheckObjectArrayStart checks whether next token is '[' or "{" in JSON byte stream. It returns true if it is "{" if there wasn't any error.
func CheckObjectStart ¶
CheckObjectStart checks whether next token is '{' in JSON byte stream.
func CheckRootArrayStart ¶
CheckRootArrayStart checks whether JSON byte stream starts with '['
func CheckRootObjectStart ¶
CheckRootObjectStart checks whether JSON byte stream starts with '{'
func GetArray ¶
GetArray unmarshals whole array from JSON byte stream to an []interface{}. []interface{} item is an array of Pairs or primitive value or []interface{}.
func GetBoolean ¶
GetBoolean unmarshals boolean value from JSON byte stream.
func GetStringSequence ¶
GetStringSequence iterates over object keys or string array items in JSON byte stream.
func GetStringSequenceFromArray ¶
func GetStringSequenceFromArray(d *json.Decoder, f func(idx int, s string) error, desc string) error
GetStringSequenceFromArray iterates over string array items in JSON byte stream.
func GetStringSequenceFromObject ¶
func GetStringSequenceFromObject(d *json.Decoder, f func(idx int, s string) error, desc string) error
GetStringSequenceFromObject iterates over object keys in JSON byte stream.
func GetUndefined ¶
GetUndefined unmarshals whole part of JSON byte stream. Part is an object or an array or primitive value. It returns array of Pairs or primitive value or []interface{}.
func SkipObject ¶
SkipObject skips object in JSON byte stream.
func UnmarshalObject ¶
UnmarshalObject sequentially unmarshals object from JSON byte stream.