You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+96-14Lines changed: 96 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,30 +1,114 @@
1
1
# RFC 9535 JSONPath: Query Expressions for JSON in Python
2
2
3
-
We follow [RFC 9535](https://datatracker.ietf.org/doc/html/rfc9535) strictly and test against the [JSONPath Compliance Test Suite](https://github.com/jsonpath-standard/jsonpath-compliance-test-suite).
4
-
5
-
See also [Python JSONPath](https://github.com/jg-rp/python-jsonpath), which also follows RFC 9535, but with additional features and customization options.
3
+
<h1align="center"># RFC 9535 JSONPath: Query Expressions for JSON in Python</h1>
4
+
5
+
<palign="center">
6
+
We follow <ahref="https://datatracker.ietf.org/doc/html/rfc9535">RFC 9535</a> strictly and test against the <ahref="https://github.com/jsonpath-standard/jsonpath-compliance-test-suite">JSONPath Compliance Test Suite</a>.
-[Python JSONPath](https://github.com/jg-rp/python-jsonpath) - Another Python package implementing JSONPath, but with additional features and customization options.
109
+
-[JSON P3](https://github.com/jg-rp/json-p3) - RFC 9535 implemented in TypeScript.
110
+
111
+
## API
28
112
29
113
### find
30
114
@@ -40,13 +124,6 @@ Each `JSONPathNode` has:
40
124
- a `location` property, which is a tuple of property names and array/list indexes that were required to reach the node's value in the target JSON document.
41
125
- a `path()` method, which returns the normalized path to the node in the target JSON document.
42
126
43
-
The returned list is a subclass of `list` with some helper methods.
44
-
45
-
-`values()` returns a list of values, one for each node.
46
-
-`items()` returns a list of `(normalized path, value)` tuples, one tuple for each node in the list.
47
-
48
-
**Example:**
49
-
50
127
```python
51
128
import jsonpath_rfc9535 as jsonpath
52
129
@@ -67,6 +144,11 @@ for node in jsonpath.find("$.users[?@.score > 85]", value):
67
144
# {'name': 'John', 'score': 86, 'admin': True} at '$['users'][1]'
68
145
```
69
146
147
+
`JSONPathNodeList` is a subclass of `list` with some helper methods.
148
+
149
+
-`values()` returns a list of values, one for each node.
150
+
-`items()` returns a list of `(normalized path, value)` tuples.
0 commit comments