Documentation ¶
Index ¶
- func Array(json map[string]interface{}, path ...string) ([]map[string]interface{}, bool)
- func Bool(json map[string]interface{}, path ...string) (bool, bool)
- func BoolArray(json map[string]interface{}, path ...string) ([]bool, bool)
- func Copy(j map[string]interface{}) (map[string]interface{}, error)
- func DoubleArray(json map[string]interface{}, path ...string) ([][]map[string]interface{}, bool)
- func Exists(json map[string]interface{}, path ...string) bool
- func Float(json map[string]interface{}, path ...string) (float64, bool)
- func FloatArray(json map[string]interface{}, path ...string) ([]float64, bool)
- func FloatDefault(json map[string]interface{}, def float64, path ...string) float64
- func Get(json map[string]interface{}, path ...string) (map[string]interface{}, bool)
- func Int(json map[string]interface{}, path ...string) (int, bool)
- func IntArray(json map[string]interface{}, path ...string) ([]int, bool)
- func IntDefault(json map[string]interface{}, def int, path ...string) int
- func Interface(json map[string]interface{}, path ...string) (interface{}, bool)
- func InterfaceArray(json map[string]interface{}, path ...string) ([]interface{}, bool)
- func Map(json map[string]interface{}, path ...string) (map[string]map[string]interface{}, bool)
- func MapToStruct(res interface{}, arg map[string]interface{}) error
- func Marshal(j interface{}) ([]byte, error)
- func ReadFile(file string) (map[string]interface{}, error)
- func String(json map[string]interface{}, path ...string) (string, bool)
- func StringArray(json map[string]interface{}, path ...string) ([]string, bool)
- func StringDefault(json map[string]interface{}, def string, path ...string) string
- func Struct(j map[string]interface{}, arg interface{}, path ...string) bool
- func StructToMap(arg interface{}) map[string]interface{}
- func Unmarshal(data []byte) (map[string]interface{}, error)
- type RawMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶
Copy will copy the JSON data deeply by value, this process involves marshalling and then unmarshalling the data.
func DoubleArray ¶
DoubleArray returns an [][]map[string]interface{} property under the given key.
func FloatArray ¶
FloatArray returns a []float64 property under the given key.
func FloatDefault ¶
FloatDefault returns a float property under the given key, if it doesn't exist, it will return the provided default.
func IntDefault ¶
IntDefault returns an int property under the given key, if it doesn't exist, it will return the provided default.
func InterfaceArray ¶
InterfaceArray returns a []interface{} under the given path.
func MapToStruct ¶
MapToStruct converts a map[string]interface{} to its struct equivalent.
func Marshal ¶
Marshal marhsals JSON into a byte slice, convenience wrapper for the native package so no need to import both and get a name collision.
func ReadFile ¶
ReadFile will read a json file into a byte array and unmarshal it to a map[string]interface
func StringArray ¶
StringArray returns an []string property under the given key.
func StringDefault ¶
StringDefault returns a string property under the given key, if it doesn't exist, it will return the provided default.
func StructToMap ¶
func StructToMap(arg interface{}) map[string]interface{}
StructToMap converts a struct to its map[string]interface{} equivalent.