python-jsonpath-rw-ext
Extensions for JSONPath RW
jsonpath-rw-ext extends json-path-rw capabilities by adding multiple extensions. ‘len’ that allows one to get the length of a list. ‘sorted’ that returns a sorted version of a list, ‘arithmetic’ that permits one to make math operation between elements and ‘filter’ to select only certain elements of a list.
Each extensions will be proposed upstream and will stay here only if they are refused.
Free software: Apache license
Documentation: https://python-jsonpath-rw-ext.readthedocs.org/en/latest/
Quick Start
At the command line:
$ pip install jsonpath-rw-ext
Or, if you have virtualenvwrapper installed:
$ mkvirtualenv jsonpath-rw-ext $ pip install jsonpath-rw-ext
To replace the jsonpath_rw parser by this one with:
import jsonpath_rw_ext
jsonpath_rw_ext.parse("$.foo").find(...)
Or:
from jsonpath_rw_ext import parser
parser.ExtentedJsonPathParser().parse("$.foo").find(...)
The jsonpath classes are not part of the public API, because the name/structure can change when they will be implemented upstream. Only the syntax shouldn’t change.
Extensions
name |
Example |
|---|---|
len |
|
sub |
|
split |
|
sorted |
|
filter |
|
arithmetic (-+*/) |
|
About arithmetic and string
Operations are done with python operators and allows types that python allows, and return [] if the operation can be done due to incompatible types.
When operators are used, a jsonpath must be be fully defined otherwise jsonpath-rw-ext can’t known if the expression is a string or a jsonpath field, in this case it will choice string as type.
Example with data:
{
'cow': 'foo',
'fish': 'bar'
}
About arithmetic and list
Arithmetic can be used against two lists if they have the same size.
Example with data:
{'objects': [
{'cow': 2, 'cat': 3},
{'cow': 4, 'cat': 6}
]}
Metadata
Release files for jsonpath-rw-ext 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| jsonpath-rw-ext-1.1.2.tar.gz | 19.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jsonpath_rw_ext-1.1.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 36.1 kB
Release files / jsonpath-rw-ext-1.1.2.tar.gz
| Download URL | jsonpath-rw-ext-1.1.2.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b56d0b67a5c13cc2c7a02c41df35dd02e90a33a43facb945caf198600e5bab6
|
|
BLAKE2b-256 checksum How to use checksums |
3120d1a7c3a77fad175f613fb53f351a908319a031903aa1499564add466cf13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / jsonpath_rw_ext-1.1.2-py2.py3-none-any.whl
| Download URL | jsonpath_rw_ext-1.1.2-py2.py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7b5621c38d20bbea978c75e311721b81528fdb6b51db355f6811752301c3be55
|
|
BLAKE2b-256 checksum How to use checksums |
ee6199dd6298c886550bd11033b510c38b63607e724acbd50c30f7a9f6c98e37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for jsonpath-rw-ext 1.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.