Skip to content

Commit c969bfe

Browse files
author
Rami.D
committed
Fix AND Update REDAME.md to include ObjectEach(..)
1 parent 8c2d6bb commit c969bfe

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,15 @@ if value, _, err := jsonparser.GetInt(data, "company", "size"); err == nil {
5555
size = value
5656
}
5757

58-
// You can use `ArrayEach` helper to iterate items
58+
// You can use `ArrayEach` helper to iterate items [item1, item2 .... itemN]
5959
jsonparser.ArrayEach(data, func(value []byte, dataType jsonparser.ValueType, offset int, err error) {
6060
fmt.Println(jsonparser.Get(value, "url"))
61-
}, "person", "gravatar", "avatars")
61+
}, "person", "avatars")
62+
63+
// You can use `ObjectEach` helper to iterate objects { "key1":object1, "key2":object2, .... "keyN":objectN }
64+
jsonparser.ArrayEach(data, func(key []byte, value []byte, dataType jsonparser.ValueType, offset int, err error) {
65+
fmt.Printf("Key: '%s'\n Value: '%s'\n Type: %s\n", string(key), string(value), dataType)
66+
}, "person", "avatars")
6267
```
6368

6469
## Need to speedup your app?

0 commit comments

Comments
 (0)