Documentation ¶
Index ¶
- Variables
- type Jsonic
- func (j *Jsonic) Child(path string) (*Jsonic, error)
- func (j *Jsonic) Get(path string) (interface{}, error)
- func (j *Jsonic) GetArray(path string) ([]interface{}, error)
- func (j *Jsonic) GetBool(path string) (bool, error)
- func (j *Jsonic) GetBoolArray(path string) ([]bool, error)
- func (j *Jsonic) GetBoolMap(path string) (map[string]bool, error)
- func (j *Jsonic) GetFloat(path string) (float32, error)
- func (j *Jsonic) GetFloat64(path string) (float64, error)
- func (j *Jsonic) GetFloat64Array(path string) ([]float64, error)
- func (j *Jsonic) GetFloat64Map(path string) (map[string]float64, error)
- func (j *Jsonic) GetFloatArray(path string) ([]float32, error)
- func (j *Jsonic) GetFloatMap(path string) (map[string]float32, error)
- func (j *Jsonic) GetInt(path string) (int, error)
- func (j *Jsonic) GetInt64(path string) (int64, error)
- func (j *Jsonic) GetInt64Array(path string) ([]int64, error)
- func (j *Jsonic) GetInt64Map(path string) (map[string]int64, error)
- func (j *Jsonic) GetIntArray(path string) ([]int, error)
- func (j *Jsonic) GetIntMap(path string) (map[string]int, error)
- func (j *Jsonic) GetMap(path string) (map[string]interface{}, error)
- func (j *Jsonic) GetString(path string) (string, error)
- func (j *Jsonic) GetStringArray(path string) ([]string, error)
- func (j *Jsonic) GetStringMap(path string) (map[string]string, error)
- func (j *Jsonic) GetTyped(path string, val interface{}) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnexpectedJSONData = errors.New("unexpected json data provided, neither array nor object") ErrIndexNotFound = errors.New("expected index for json array but found something else") ErrIndexOutOfBound = errors.New("index out of bounds of the json array") ErrNoDataFound = errors.New("no tree satisfies the path elements provided") ErrInvalidType = errors.New("data at the specified path does not match the expected type") )
errors
Functions ¶
This section is empty.
Types ¶
type Jsonic ¶
type Jsonic struct {
// contains filtered or unexported fields
}
Jsonic is the type to hold the JSON data
func (*Jsonic) Child ¶
Child returns the json tree at the path specified.
It returns an error in case there is nothing that can be resolved at the specified path.
Path should be like this for example - a.[0].b, [0].a.b, etc. The path elements should be separated with dots. Now the path elements can either be the index in case of an array with the index enclosed within square brackets or it can be the key of the object.
func (*Jsonic) GetBoolArray ¶
GetBoolArray is used to get the boolean array at the path specified.
func (*Jsonic) GetBoolMap ¶
GetBoolMap is used to get the boolean map at the path specified.
func (*Jsonic) GetFloat64 ¶
GetFloat64 is used to get the floating point number at the path specified.
func (*Jsonic) GetFloat64Array ¶
GetFloat64Array is used to get the 64-bit floating point number array at the path specified.
func (*Jsonic) GetFloat64Map ¶
GetFloat64Map is used to get the 64-bit floating point number map at the path specified.
func (*Jsonic) GetFloatArray ¶
GetFloatArray is used to get the floating point number array at the path specified.
func (*Jsonic) GetFloatMap ¶
GetFloatMap is used to get the floating point number map at the path specified.
func (*Jsonic) GetInt64Array ¶
GetInt64Array is used to get the 64-bit integer array at the path specified.
func (*Jsonic) GetInt64Map ¶
GetInt64Map is used to get the 64-bit integer map at the path specified.
func (*Jsonic) GetIntArray ¶
GetIntArray is used to get the integer array at the path specified.
func (*Jsonic) GetStringArray ¶
GetStringArray is used to get the string array at the path specified.
func (*Jsonic) GetStringMap ¶
GetStringMap is used to get the string map at the path specified.