Skip to content

Commit efb0f7d

Browse files
committed
Update docs WIP [skip ci]
1 parent f384b63 commit efb0f7d

File tree

4 files changed

+187
-101
lines changed

4 files changed

+187
-101
lines changed

docs/advanced.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -257,23 +257,3 @@ env = MyJSONPathEnvironment()
257257
query = env.compile("$.users[999]")
258258
# jsonpath.exceptions.JSONPathIndexError: index out of range, line 1, column 8
259259
```
260-
261-
### Subclassing Lexer
262-
263-
TODO:
264-
265-
### Subclassing Parser
266-
267-
TODO:
268-
269-
### Get Item
270-
271-
TODO:
272-
273-
### Truthiness and Existence
274-
275-
TODO:
276-
277-
### Filter Infix Expressions
278-
279-
TODO:

docs/index.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
JSONPath is a mini language for selecting values from data formatted in JavaScript Object Notation, or equivalent Python objects, like dictionaries and lists.
44

5-
Python JSONPath is a non-evaluating, read-only implementation of JSONPath, suitable for situations where JSONPath query authors are untrusted. We follow most of [RFC 9535](https://datatracker.ietf.org/doc/html/rfc9535). See [Notable differences](syntax.md#notable-differences) for a list of areas where we deviate from the standard.
5+
Python JSONPath is a non-evaluating, read-only implementation of JSONPath, suitable for situations where JSONPath query authors are untrusted. We follow [RFC 9535](https://datatracker.ietf.org/doc/html/rfc9535) and test against the [JSONPath Compliance Test Suite](https://github.com/jsonpath-standard/jsonpath-compliance-test-suite).
66

77
We also include implementations of [JSON Pointer](pointers.md) ([RFC 6901](https://datatracker.ietf.org/doc/html/rfc6901)) and [JSON Patch](api.md#jsonpath.JSONPatch) ([RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902)), plus methods for converting a [JSONPathMatch](api.md#jsonpath.JSONPathMatch) to a `JSONPointer`.
88

@@ -32,6 +32,14 @@ Or from [conda-forge](https://anaconda.org/conda-forge/python-jsonpath):
3232
conda install -c conda-forge python-jsonpath
3333
```
3434

35+
### Optional dependencies
36+
37+
By default, and without any additional dependencies, the JSONPath syntax supported by Python JSONPath is **very close** to RFC 9535. For strict compatibility with RFC 9535, install [regex](https://pypi.org/project/regex/) and [iregexp-check](https://pypi.org/project/iregexp-check/) packages too.
38+
39+
With these two packages installed, the [`match()`](functions.md#match) and [`search()`](functions.md#search) filter functions will use [regex](https://pypi.org/project/regex/) instead of `re` from the standard library, and will validate regular expression patterns against [RFC 9485](https://datatracker.ietf.org/doc/html/rfc9485).
40+
41+
Aso see [strict mode](syntax.md#strict-mode) for more information about strict compatibility with RFC 9535.
42+
3543
## Example
3644

3745
```python

docs/quickstart.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ This page gets you started using JSONPath, JSON Pointer and JSON Patch wih Pytho
44

55
## `findall(path, data)`
66

7-
Find all values matching a JSONPath expression using [`jsonpath.findall()`](api.md#jsonpath.JSONPathEnvironment.findall).
7+
Find all values matching a JSONPath query using [`jsonpath.findall()`](api.md#jsonpath.JSONPathEnvironment.findall).
88

99
This function takes two arguments:
1010

11-
- `path`: a JSONPath expression as a string (e.g., `"$.users[*].name"`)
11+
- `path`: a JSONPath query as a string (e.g., `"$.users[*].name"`)
1212
- `data`: the JSON document to query
1313

14-
It always returns a **list** of matched values, even if the path resolves to a single result or nothing at all.
14+
It **always** returns a list of matched values, even if the path resolves to a single result or nothing at all.
1515

1616
The `data` argument can be:
1717

@@ -65,7 +65,7 @@ with open("users.json") as fd:
6565

6666
## `finditer(path, data)`
6767

68-
Use [`jsonpath.finditer()`](api.md#jsonpath.JSONPathEnvironment.finditer) to iterate over instances of [`jsonpath.JSONPathMatch`](api.md#jsonpath.JSONPathMatch) for every object in _data_ that matches _path_. It accepts the same arguments as [`findall()`](#findallpath-data), a path string and data from which to select matches.
68+
Use [`jsonpath.finditer()`](api.md#jsonpath.JSONPathEnvironment.finditer) to iterate over instances of [`jsonpath.JSONPathMatch`](api.md#jsonpath.JSONPathMatch) for every object in _data_ that matches _path_. It accepts the same arguments as [`findall()`](#findallpath-data), a query string and data from which to select matches.
6969

7070
```python
7171
import jsonpath
@@ -109,7 +109,7 @@ The selected object is available from a [`JSONPathMatch`](api.md#jsonpath.JSONPa
109109

110110
## `compile(path)`
111111

112-
When you have a JSONPath that needs to be matched against different data repeatedly, you can _compile_ the path ahead of time using [`jsonpath.compile()`](api.md#jsonpath.JSONPathEnvironment.compile). It takes a path as a string and returns a [`JSONPath`](api.md#jsonpath.JSONPath) instance. `JSONPath` has `findall()` and `finditer()` methods that behave similarly to package-level `findall()` and `finditer()`, just without the `path` argument.
112+
When you have a JSONPath query that needs to be matched against different data repeatedly, you can compile the path ahead of time using [`jsonpath.compile()`](api.md#jsonpath.JSONPathEnvironment.compile). It takes a query as a string and returns an instance of [`JSONPath`](api.md#jsonpath.JSONPath). `JSONPath` has `findall()` and `finditer()` methods that behave similarly to package-level `findall()` and `finditer()`, just without the `path` argument.
113113

114114
```python
115115
import jsonpath

0 commit comments

Comments
 (0)