JMESPath with 400+ extension functions for strings, arrays, dates, hashing, encoding, and more
Project description
jmespath-extensions
JMESPath with 400+ extension functions for strings, arrays, dates, hashing, encoding, and more.
This package provides Python bindings for jmespath-extensions, a Rust library that extends JMESPath with hundreds of additional functions.
Installation
pip install jmespath-extensions
Quick Start
import jmespath_extensions as jpx
# String functions
jpx.search("upper(name)", {"name": "alice"})
# 'ALICE'
# Math functions
jpx.search("sum(values)", {"values": [1, 2, 3, 4, 5]})
# 15
jpx.search("median(scores)", {"scores": [10, 20, 30, 40, 50]})
# 30
# Date/time functions
jpx.search("format_date(now(), '%Y-%m-%d')", {})
# '2024-01-15'
# Array functions
jpx.search("unique(items)", {"items": [1, 2, 2, 3, 3, 3]})
# [1, 2, 3]
jpx.search("chunk(items, `2`)", {"items": [1, 2, 3, 4, 5, 6]})
# [[1, 2], [3, 4], [5, 6]]
# Object functions
jpx.search("pick(user, ['name', 'email'])", {"user": {"name": "alice", "email": "a@b.com", "age": 30}})
# {'name': 'alice', 'email': 'a@b.com'}
# Hash functions
jpx.search("md5(password)", {"password": "secret"})
# '5ebe2294ecd0e0f08eab7690d2a6ee69'
# Fuzzy matching
jpx.search("levenshtein(a, b)", {"a": "kitten", "b": "sitting"})
# 3
Compiled Expressions
For repeated searches, compile the expression once:
import jmespath_extensions as jpx
# Compile once
expr = jpx.compile("users[?age > `18`].name | sort(@)")
# Use many times
expr.search({"users": [{"name": "alice", "age": 30}, {"name": "bob", "age": 16}]})
# ['alice']
expr.search({"users": [{"name": "charlie", "age": 25}, {"name": "dave", "age": 19}]})
# ['charlie', 'dave']
Function Discovery
import jmespath_extensions as jpx
# List all categories
jpx.list_categories()
# ['standard', 'string', 'array', 'object', 'math', 'type', 'utility', ...]
# List functions in a category
jpx.list_functions("string")
# ['upper', 'lower', 'trim', 'split', 'replace', 'camel_case', ...]
# Get function details
jpx.describe("upper")
# {
# 'name': 'upper',
# 'category': 'string',
# 'description': 'Convert string to uppercase',
# 'signature': 'string -> string',
# 'example': "upper('hello') -> \"HELLO\"",
# 'is_standard': False
# }
Function Categories
| Category | Examples |
|---|---|
| string | upper, lower, trim, split, replace, camel_case, snake_case |
| array | first, last, unique, chunk, zip, flatten, group_by |
| object | pick, omit, deep_merge, flatten_keys, items, from_items |
| math | round, sqrt, median, stddev, sum, avg, min, max |
| datetime | now, format_date, parse_date, date_add, date_diff |
| hash | md5, sha1, sha256, crc32 |
| encoding | base64_encode, base64_decode, hex_encode, url_encode |
| regex | regex_match, regex_extract, regex_replace |
| fuzzy | levenshtein, jaro_winkler, soundex, metaphone |
| geo | geo_distance_km, geo_bearing |
| validation | is_email, is_url, is_uuid, is_ipv4 |
| uuid | uuid (v4 generation) |
| ids | nanoid, ulid |
See the full documentation for all 400+ functions.
Compatibility with jmespath-py
This package is designed to be a drop-in enhancement for jmespath. All standard JMESPath functions work exactly as expected:
import jmespath_extensions as jpx
# Standard JMESPath still works
jpx.search("length(items)", {"items": [1, 2, 3]})
# 3
jpx.search("sort(items)", {"items": [3, 1, 2]})
# [1, 2, 3]
jpx.search("[?age > `18`]", [{"age": 20}, {"age": 15}])
# [{'age': 20}]
Performance
This package uses Rust under the hood via PyO3, providing near-native performance for JSON processing.
License
MIT OR Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jmespath_extensions-0.9.0.tar.gz.
File metadata
- Download URL: jmespath_extensions-0.9.0.tar.gz
- Upload date:
- Size: 265.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
241cdef5e767fd032142cfb57e65a04ae4ade76a545d08c0895fbb64b2b523d5
|
|
| MD5 |
d205bb4e7da2b659ccdfccde556a21a2
|
|
| BLAKE2b-256 |
7d5ce8e0934501af332a09edcd4f787ff7697d25021afc66fa9dc85ff49f08b0
|
Provenance
The following attestation bundles were made for jmespath_extensions-0.9.0.tar.gz:
Publisher:
python-release.yml on joshrotenberg/jmespath-extensions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jmespath_extensions-0.9.0.tar.gz -
Subject digest:
241cdef5e767fd032142cfb57e65a04ae4ade76a545d08c0895fbb64b2b523d5 - Sigstore transparency entry: 915587557
- Sigstore integration time:
-
Permalink:
joshrotenberg/jmespath-extensions@ff8c55bf132ad2c025a982a4b80550c88143fa1a -
Branch / Tag:
refs/tags/py-v0.9.0 - Owner: https://github.com/joshrotenberg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@ff8c55bf132ad2c025a982a4b80550c88143fa1a -
Trigger Event:
push
-
Statement type:
File details
Details for the file jmespath_extensions-0.9.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: jmespath_extensions-0.9.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc30c62e9ba47281dca90f4fba74acdb1d32f2311c783cccc2691f2726218a72
|
|
| MD5 |
09eb20c098a9a629c03dfd7b42678996
|
|
| BLAKE2b-256 |
39093d9c83eef7ef646f0fbb3ff8ee021d5715a83a7b9ed20150db239d510abb
|
Provenance
The following attestation bundles were made for jmespath_extensions-0.9.0-cp312-cp312-win_amd64.whl:
Publisher:
python-release.yml on joshrotenberg/jmespath-extensions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jmespath_extensions-0.9.0-cp312-cp312-win_amd64.whl -
Subject digest:
cc30c62e9ba47281dca90f4fba74acdb1d32f2311c783cccc2691f2726218a72 - Sigstore transparency entry: 915587934
- Sigstore integration time:
-
Permalink:
joshrotenberg/jmespath-extensions@ff8c55bf132ad2c025a982a4b80550c88143fa1a -
Branch / Tag:
refs/tags/py-v0.9.0 - Owner: https://github.com/joshrotenberg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@ff8c55bf132ad2c025a982a4b80550c88143fa1a -
Trigger Event:
push
-
Statement type:
File details
Details for the file jmespath_extensions-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: jmespath_extensions-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5be63c875de15b7aa1b4d17b7da994673045257eb1d3d021a8ef9192b1e915af
|
|
| MD5 |
f646494b942970ce21e5fa28d576bb54
|
|
| BLAKE2b-256 |
e7ce5ea49e75a23c3d4b76bedb5909a1206c69159c021e4f215b14f118254b2c
|
Provenance
The following attestation bundles were made for jmespath_extensions-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
python-release.yml on joshrotenberg/jmespath-extensions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jmespath_extensions-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
5be63c875de15b7aa1b4d17b7da994673045257eb1d3d021a8ef9192b1e915af - Sigstore transparency entry: 915588027
- Sigstore integration time:
-
Permalink:
joshrotenberg/jmespath-extensions@ff8c55bf132ad2c025a982a4b80550c88143fa1a -
Branch / Tag:
refs/tags/py-v0.9.0 - Owner: https://github.com/joshrotenberg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@ff8c55bf132ad2c025a982a4b80550c88143fa1a -
Trigger Event:
push
-
Statement type:
File details
Details for the file jmespath_extensions-0.9.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: jmespath_extensions-0.9.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f268445251ac1333a9962119f76a36b0fbeeb5f8588f7a583bc4d43b6eaf881
|
|
| MD5 |
99b139df6a7c2cc258813a9d1fb4e133
|
|
| BLAKE2b-256 |
f972db3f7d1a47d174de4c2332250dc5fcadeb39da749b621b98dc5b71a7ecc8
|
Provenance
The following attestation bundles were made for jmespath_extensions-0.9.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
python-release.yml on joshrotenberg/jmespath-extensions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jmespath_extensions-0.9.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
3f268445251ac1333a9962119f76a36b0fbeeb5f8588f7a583bc4d43b6eaf881 - Sigstore transparency entry: 915587858
- Sigstore integration time:
-
Permalink:
joshrotenberg/jmespath-extensions@ff8c55bf132ad2c025a982a4b80550c88143fa1a -
Branch / Tag:
refs/tags/py-v0.9.0 - Owner: https://github.com/joshrotenberg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@ff8c55bf132ad2c025a982a4b80550c88143fa1a -
Trigger Event:
push
-
Statement type:
File details
Details for the file jmespath_extensions-0.9.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: jmespath_extensions-0.9.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c87982e094e964db8795ecb6a4f34769351f7e71095af5fe3b2b29b1750a3158
|
|
| MD5 |
d0b61dcf0d2cc05f4019971d2bab6c8e
|
|
| BLAKE2b-256 |
e6d5b4a218ba1320af520ece5aae38226f0cfe29e934e2b86bf9595259f8b03e
|
Provenance
The following attestation bundles were made for jmespath_extensions-0.9.0-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
python-release.yml on joshrotenberg/jmespath-extensions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jmespath_extensions-0.9.0-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
c87982e094e964db8795ecb6a4f34769351f7e71095af5fe3b2b29b1750a3158 - Sigstore transparency entry: 915587660
- Sigstore integration time:
-
Permalink:
joshrotenberg/jmespath-extensions@ff8c55bf132ad2c025a982a4b80550c88143fa1a -
Branch / Tag:
refs/tags/py-v0.9.0 - Owner: https://github.com/joshrotenberg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@ff8c55bf132ad2c025a982a4b80550c88143fa1a -
Trigger Event:
push
-
Statement type:
File details
Details for the file jmespath_extensions-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: jmespath_extensions-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d886baab86273cf998d30c59c001e47f1e0c1f53725bbade2157eb3e96b1ce7c
|
|
| MD5 |
35b2f585d0ae08170e8f7b07cd1b7ce5
|
|
| BLAKE2b-256 |
244dea6bd3c530c367ca48c7e330929f847833036522a1512ed50559cb09e199
|
Provenance
The following attestation bundles were made for jmespath_extensions-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl:
Publisher:
python-release.yml on joshrotenberg/jmespath-extensions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jmespath_extensions-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl -
Subject digest:
d886baab86273cf998d30c59c001e47f1e0c1f53725bbade2157eb3e96b1ce7c - Sigstore transparency entry: 915587734
- Sigstore integration time:
-
Permalink:
joshrotenberg/jmespath-extensions@ff8c55bf132ad2c025a982a4b80550c88143fa1a -
Branch / Tag:
refs/tags/py-v0.9.0 - Owner: https://github.com/joshrotenberg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@ff8c55bf132ad2c025a982a4b80550c88143fa1a -
Trigger Event:
push
-
Statement type: