Skip to content

Commit d2164d6

Browse files
committed
reuse lookup pattern
1 parent 530466c commit d2164d6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ import (
2828

2929
var json_data interface{}
3030
json.Unmarshal([]byte(data), &json_data)
31+
3132
res, err := jsonpath.JsonPathLookup(json_data, "$.expensive")
33+
34+
//or reuse lookup pattern
35+
pat, _ := jsonpath.Compile(`$.store.book[?(@.price < $.expensive)].price`)
36+
res, err := pat.Lookup(json_data)
3237
```
3338

3439
Operators

0 commit comments

Comments
 (0)