MCPcopy
hub / github.com/tidwall/gjson / ForEachLine

Function ForEachLine

gjson.go:1902–1914  ·  view source on GitHub ↗

ForEachLine iterates through lines of JSON as specified by the JSON Lines format (http://jsonlines.org/). Each line is returned as a GJSON Result.

(json string, iterator func(line Result) bool)

Source from the content-addressed store, hash-verified

1900// format (http://jsonlines.org/).
1901// Each line is returned as a GJSON Result.
1902func ForEachLine(json string, iterator func(line Result) bool) {
1903 var res Result
1904 var i int
1905 for {
1906 i, res, _ = parseAny(json, i, true)
1907 if !res.Exists() {
1908 break
1909 }
1910 if !iterator(res) {
1911 return
1912 }
1913 }
1914}
1915
1916type subSelector struct {
1917 name string

Callers 1

TestJSONLinesFunction · 0.85

Calls 2

ExistsMethod · 0.95
parseAnyFunction · 0.85

Tested by 1

TestJSONLinesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…