Skip to content

Commit e2f497d

Browse files
committed
Tweak README
1 parent aa1cd23 commit e2f497d

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ TODO:
2626

2727
## Usage
2828

29-
### `find(query, value)`
29+
### find
30+
31+
`find(query: str, value: JSONValue) -> JSONPathNodeList`
3032

3133
Apply JSONPath expression _query_ to _value_. _value_ should arbitrary, possible nested, Python dictionaries, lists, strings, integers, floats, Booleans or `None`, as you would get from [`json.load()`](https://docs.python.org/3/library/json.html#json.load).
3234

@@ -65,11 +67,9 @@ for node in jsonpath.find("$.users[?@.score > 85]", value):
6567
# {'name': 'John', 'score': 86, 'admin': True} at '$['users'][1]'
6668
```
6769

68-
### `finditer(query, value)`
69-
70-
`finditer()` accepts the same arguments as [`find()`](#findquery-value), but returns an iterator over `JSONPathNode` instances rather than a list. This could be useful if you're expecting a large number of results that you don't want to load into memory all at once.
70+
### find_one
7171

72-
### `find_one(query, value)`
72+
`find_one(query: str, value: JSONValue) -> Optional[JSONPathNode]`
7373

7474
`find_one()` accepts the same arguments as [`find()`](#findquery-value), but returns the first available `JSONPathNode`, or `None` if there were no matches.
7575

@@ -83,7 +83,15 @@ def find_one(query, value):
8383
return None
8484
```
8585

86-
### `compile(query)`
86+
### finditer
87+
88+
`finditer(query: str, value: JSONValue) -> Iterable[JSONPathNode]`
89+
90+
`finditer()` accepts the same arguments as [`find()`](#findquery-value), but returns an iterator over `JSONPathNode` instances rather than a list. This could be useful if you're expecting a large number of results that you don't want to load into memory all at once.
91+
92+
### compile
93+
94+
`compile(query: str) -> JSONPathQuery`
8795

8896
`find(query, value)` is a convenience function for `JSONPathEnvironment().compile(query).apply(value)`. Use `compile(query)` to obtain a `JSONPathQuery` instance which can be applied to difference JSON-like values repeatedly.
8997

0 commit comments

Comments
 (0)