mirror of
https://gitee.com/johng/gf
synced 2026-06-07 10:22:11 +08:00
修正gjson数据检索问题
This commit is contained in:
@ -311,6 +311,9 @@ func (j *Json) getPointerByPattern(pattern string) *interface{} {
|
||||
}
|
||||
} else {
|
||||
index = strings.LastIndex(pattern[start:index], ".")
|
||||
if index != -1 && length > 0 {
|
||||
index += length + 1
|
||||
}
|
||||
}
|
||||
if start >= index {
|
||||
break
|
||||
|
||||
@ -12,7 +12,7 @@ func Upload(r *ghttp.Request) {
|
||||
buffer := make([]byte, h.Size)
|
||||
f.Read(buffer)
|
||||
gfile.PutBinContents("/tmp/" + fname, buffer)
|
||||
r.Response.WriteString(fname + " uploaded successly"))
|
||||
r.Response.WriteString(fname + " uploaded successly")
|
||||
} else {
|
||||
r.Response.WriteString(e.Error())
|
||||
}
|
||||
|
||||
@ -7,9 +7,10 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
j, _ := gjson.Load("/home/john/Workspace/Go/GOPATH/src/gitee.com/johng/gf/geg/frame/config.json")
|
||||
c, _ := j.ToToml()
|
||||
fmt.Println(string(c))
|
||||
j, _ := gjson.Load("/home/john/Workspace/Go/GOPATH/src/gitee.com/johng/gf/geg/frame/config.yml")
|
||||
//c, _ := j.ToToml()
|
||||
//fmt.Println(j.Get("database.default").([]interface{})[0])
|
||||
fmt.Println(j.Get("database.default.0"))
|
||||
return
|
||||
data :=
|
||||
`{
|
||||
|
||||
Reference in New Issue
Block a user