mirror of https://github.com/tidwall/gjson.git
index for iterator vals
This commit is contained in:
parent
456225d161
commit
b0e589ad0b
8
gjson.go
8
gjson.go
|
@ -204,10 +204,18 @@ func (t Result) ForEach(iterator func(key, value Result) bool) {
|
||||||
key.Raw = str
|
key.Raw = str
|
||||||
key.Index = s
|
key.Index = s
|
||||||
}
|
}
|
||||||
|
for ; i < len(json); i++ {
|
||||||
|
if json[i] <= ' ' || json[i] == ',' || json[i] == ':' {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
s := i
|
||||||
i, value, ok = parseAny(json, i, true)
|
i, value, ok = parseAny(json, i, true)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
value.Index = s
|
||||||
if !iterator(key, value) {
|
if !iterator(key, value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue