Documentation ¶
Index ¶
- type JSONData
- func (jo *JSONData) Get(path string) *JSONNode
- func (jo *JSONData) GetBool(path string) (bool, error)
- func (jo *JSONData) GetFloat(path string) (float64, error)
- func (jo *JSONData) GetInt(path string) (int, error)
- func (jo *JSONData) GetRootNode() *JSONNode
- func (jo *JSONData) GetString(path string) (string, error)
- func (jo *JSONData) IsArray(path string) (bool, error)
- func (jo *JSONData) IsBool(path string) (bool, error)
- func (jo *JSONData) IsFloat(path string) (bool, error)
- func (jo *JSONData) IsInt(path string) (bool, error)
- func (jo *JSONData) IsMap(path string) (bool, error)
- func (jo *JSONData) IsString(path string) (bool, error)
- func (jo *JSONData) IsValidPath(path string) bool
- func (jo *JSONData) SetBool(path string, value bool) error
- func (jo *JSONData) SetFloat(path string, value float64) error
- func (jo *JSONData) SetInt(path string, value int) error
- func (jo *JSONData) SetString(path, value string) error
- type JSONNode
- func (n *JSONNode) Get(key string) *JSONNode
- func (n *JSONNode) GetBool() bool
- func (n *JSONNode) GetFloat() float64
- func (n *JSONNode) GetInt() int
- func (n *JSONNode) GetNodeAt(index int) *JSONNode
- func (n *JSONNode) GetString() string
- func (n *JSONNode) HaveKey(key string) bool
- func (n *JSONNode) IsArray() bool
- func (n *JSONNode) IsBool() bool
- func (n *JSONNode) IsFloat() bool
- func (n *JSONNode) IsInt() bool
- func (n *JSONNode) IsMap() bool
- func (n *JSONNode) IsString() bool
- func (n *JSONNode) Len() int
- func (n *JSONNode) Set(key string, node *JSONNode)
- func (n *JSONNode) SetBool(val bool)
- func (n *JSONNode) SetFloat(val float64)
- func (n *JSONNode) SetInt(val int)
- func (n *JSONNode) SetString(val string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONData ¶
type JSONData struct {
// contains filtered or unexported fields
}
JSONData represent a whole Json construct.
func NewJSONData ¶
NewJSONData will create a new instance of JSONData
func (*JSONData) GetBool ¶
GetBool will get the bool value from a json indicated by specified path. Error returned if path is not valid.
func (*JSONData) GetFloat ¶
GetFloat will get the float value from a json indicated by specified path. Error returned if path is not valid.
func (*JSONData) GetInt ¶
GetInt will get the int value from a json indicated by specified path. Error returned if path is not valid.
func (*JSONData) GetRootNode ¶
GetRootNode will return the root node of this JSONData
func (*JSONData) GetString ¶
GetString will get the string value from a json indicated by specified path. Error returned if path is not valid.
func (*JSONData) IsArray ¶
IsArray will check if the node indicated by specified path is an Array node
func (*JSONData) IsFloat ¶
IsFloat will check if the node indicated by specified path is a float node
func (*JSONData) IsString ¶
IsString will check if the node indicated by specified path is a string node
func (*JSONData) IsValidPath ¶
IsValidPath will check if the provided path is valid
type JSONNode ¶
type JSONNode struct {
// contains filtered or unexported fields
}
JSONNode represent a node in JSON Tree
func (*JSONNode) Get ¶
Get will fetch the child not designated with specified key. Will panic if this node is not a map
func (*JSONNode) GetBool ¶
GetBool will get the bool value of this node. Will panic if this node is not a boolean
func (*JSONNode) GetFloat ¶
GetFloat will get the float value of this node. Will panic if this node is not a float.
func (*JSONNode) GetInt ¶
GetInt will get the int value of this node. Will panic if this node is not an int
func (*JSONNode) GetNodeAt ¶
GetNodeAt will get the child not on specific index. Will panic if this not is not an array
func (*JSONNode) GetString ¶
GetString will get the string value of this node. Will panic if this node is not a string
func (*JSONNode) HaveKey ¶
HaveKey will check if the map contains specified key. Will panic if this node is not a map
func (*JSONNode) Len ¶
Len return length of element in this array. Will panic if this node is not an array
func (*JSONNode) Set ¶
Set will set the value of a map designated with specified key. Will panic if this node is not a map
func (*JSONNode) SetBool ¶
SetBool will set this node value with boolean value, will panic if this node is not a bool
func (*JSONNode) SetFloat ¶
SetFloat will set this node value with float value. Will panic if this node is not a float