JSON(python dict) finder
Install
- pip install jsonfind
CLI
# jsonfind
Usage: jsonfind [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
find-by
find-eq
find-is
find-key
find-subset
# jsonfind find-eq --help
Usage: jsonfind find-eq [OPTIONS] [OBJ]
Options:
--verbose / --no-verbose
--target TEXT query(JSON string) [required]
--format [jsonpath|jsonpointer]
--help Show this message and exit.
- jo hello=world a=$(jo b=$(jo c=d))
{"hello":"world","a":{"b":{"c":"d"}}}
- jo hello=world a=$(jo b=$(jo c=d)) | jsonfind find-eq --target $(jo c=d) --format jsonpointer
["/a/b"]
- jo hello=world a=$(jo b=$(jo c=d)) | ./bin/jsonfind find-eq --target $(jo c=d) --format jsonpath
["a.b"]
- jo hello=world a=$(jo b=$(jo c=d)) | ./bin/jsonfind find-by --format jsonpointer --query /a/b
{"c": "d"}
- jo hello=world a=$(jo b=$(jo c=d)) | ./bin/jsonfind find-by --format jsonpath --query a.b
[{"c": "d"}]
Python
>>> from jsonfind import JsonFind
>>> obj = {"a":"b","c":{"d":"e"}}
>>> tgt = obj["c"]
>>> JsonFind.to_jsonpointer(JsonFind.find_eq(obj, tgt))
'/c'
>>> JsonFind.to_jsonpath(JsonFind.find_eq(obj, tgt))
'c'
Metadata
Release files for jsonfind 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jsonfind-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / jsonfind-0.1-py3-none-any.whl
| Download URL | jsonfind-0.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9c10ffe9d8dc6f94dc1e1405aad73992f62222a7a74f3adbd96ecb65df97f29
|
|
BLAKE2b-256 checksum How to use checksums |
7bf7557897d4c594c5bf818ae2c0b63f0cd12706429d346cff20e4ec500b6578
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.8.0
|