Inspect json data and fuzzy search for values or key names
Project description
Fuzzy matching for JSON payload. Find json_path that matches best for your provided value
Demo: https://huggingface.co/spaces/3cham/jsfuzz
Install
$ pip install jsfuzz
Examples:
{
"id": 11,
"title": "perfume Oil",
"description": "Mega Discount, Impression of A...",
"price": 13,
"discountPercentage": 8.4,
"rating": 4.26,
"stock": 65,
"brand": "Impression of Acqua Di Gio",
"category": "fragrances",
"thumbnail": "https://i.dummyjson.com/data/products/11/thumbnail.jpg",
"images": [
"https://i.dummyjson.com/data/products/11/1.jpg",
"https://i.dummyjson.com/data/products/11/2.jpg",
"https://i.dummyjson.com/data/products/11/3.jpg",
"https://i.dummyjson.com/data/products/11/thumbnail.jpg"
]
}
from jsfuzz import inspector
# Default top_k=5 json paths will be returned
result = inspector.search(payload, "brand")
pprint(result)
====================
Returns:
[('$.brand', 'Impression of Acqua Di Gio', 75.80645161290323),
('$.rating', '4.26', 38.18181818181817),
('$.category', 'fragrances', 22.769230769230766),
('$.thumbnail',
'https://i.dummyjson.com/data/products/11/thumbnail.jpg',
22.033898305084744),
('$.description', 'Mega Discount, Impression of A...', 20.657894736842106)]
result = inspector.search(payload, "65", top_k=10)
pprint(result)
====================
Returns:
[('$.stock', '65', 30.0),
('$.rating', '4.26', 20.0),
('$.thumbnail', 'https://i.dummyjson.com/data/products/11/thumbnail.jpg', 0.0),
('$.category', 'fragrances', 0.0),
('$.brand', 'Impression of Acqua Di Gio', 0.0),
('$.discountPercentage', '8.4', 0.0),
('$.price', '13', 0.0),
('$.description', 'Mega Discount, Impression of A...', 0.0),
('$.title', 'perfume Oil', 0.0),
('$.id', '11', 0.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
jsfuzz-1.0.0.tar.gz
(2.8 kB
view details)
Built Distribution
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 jsfuzz-1.0.0.tar.gz.
File metadata
- Download URL: jsfuzz-1.0.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb7d23307154f7db7eb3eb085f1b2a4966131bc4d8854a37049c4e169f1874a1
|
|
| MD5 |
be0c44c84294b401c92b010b6914c403
|
|
| BLAKE2b-256 |
a1b2b3f9efb7975529ffbffbdece9316866981ae2c05f7340f96365473cede12
|
File details
Details for the file jsfuzz-1.0.0-py3-none-any.whl.
File metadata
- Download URL: jsfuzz-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a5e5882082e4f09919e6edaedf3e14a7bfd964e1ee60fda7b97fbc0f4630067
|
|
| MD5 |
add397d0b4ec8d6694fea6cb02bf707c
|
|
| BLAKE2b-256 |
749302e5a8dbee36ec5a32083426a6d3750e6f7f747f78ebe3317fc3a223af7b
|