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

Method Keys

gjson.go:3630–3636  ·  view source on GitHub ↗

Keys iterates over a json result. This works identically to ForEach, but allows modern Go loops: for key := range res.Keys() { fmt.Printf("%s\n", key) }

()

Source from the content-addressed store, hash-verified

3628// fmt.Printf("%s\n", key)
3629// }
3630func (t Result) Keys() iter.Seq[Result] {
3631 return func(yield func(Result) bool) {
3632 t.ForEach(func(key, _ Result) bool {
3633 return yield(key)
3634 })
3635 }
3636}
3637
3638// Values iterates over a json result.
3639// This works identically to ForEach, but allows modern Go loops:

Callers 1

TestIterFunction · 0.80

Calls 1

ForEachMethod · 0.95

Tested by 1

TestIterFunction · 0.64