Documentation ¶
Overview ¶
JSON解析/封装. 单元测试请参考gpaser包.
Index ¶
- func Decode(b []byte) (interface{}, error)
- func DecodeTo(b []byte, v interface{}) error
- func Encode(v interface{}) ([]byte, error)
- type Json
- func (j *Json) Get(pattern string) interface{}
- func (j *Json) GetArray(pattern string) []interface{}
- func (j *Json) GetBool(pattern string) bool
- func (j *Json) GetFloat32(pattern string) float32
- func (j *Json) GetFloat64(pattern string) float64
- func (j *Json) GetInt(pattern string) int
- func (j *Json) GetInt16(pattern string) int16
- func (j *Json) GetInt32(pattern string) int32
- func (j *Json) GetInt64(pattern string) int64
- func (j *Json) GetInt8(pattern string) int8
- func (j *Json) GetJson(pattern string) *Json
- func (j *Json) GetMap(pattern string) map[string]interface{}
- func (j *Json) GetString(pattern string) string
- func (j *Json) GetToVar(pattern string, v interface{}) error
- func (j *Json) GetUint(pattern string) uint
- func (j *Json) GetUint16(pattern string) uint16
- func (j *Json) GetUint32(pattern string) uint32
- func (j *Json) GetUint64(pattern string) uint64
- func (j *Json) GetUint8(pattern string) uint8
- func (j *Json) Remove(pattern string) error
- func (j *Json) Set(pattern string, value interface{}) error
- func (j *Json) SetSplitChar(char byte)
- func (j *Json) SetViolenceCheck(check bool)
- func (j *Json) ToArray() []interface{}
- func (j *Json) ToJson() ([]byte, error)
- func (j *Json) ToJsonIndent() ([]byte, error)
- func (j *Json) ToMap() map[string]interface{}
- func (j *Json) ToStruct(o interface{}) error
- func (j *Json) ToToml() ([]byte, error)
- func (j *Json) ToXml(rootTag ...string) ([]byte, error)
- func (j *Json) ToXmlIndent(rootTag ...string) ([]byte, error)
- func (j *Json) ToYaml() ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Json ¶
type Json struct {
// contains filtered or unexported fields
}
json解析结果存放数组
func LoadContent ¶
支持的配置文件格式:xml, json, yaml/yml, toml
func (*Json) Get ¶
根据约定字符串方式访问json解析数据,参数形如: "items.name.first", "list.0" 返回的结果类型的interface{},因此需要自己做类型转换 如果找不到对应节点的数据,返回nil
func (*Json) GetFloat32 ¶
func (*Json) GetFloat64 ¶
func (*Json) ToJsonIndent ¶
Click to show internal directories.
Click to hide internal directories.