Skip to main content

search dict

Project description

JSON(python dict) finder

Install

  • pip install jsonfind

CLI

# jsonfind
Usage: jsonfind [OPTIONS] COMMAND [ARGS]...

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  find-any
  find-by
  find-eq
  find-is
  find-key
  find-regex
  find-subset

# jsonfind find-any --help
Usage: jsonfind find-any [OPTIONS] [OBJ]

Options:
  --verbose / --no-verbose
  --target TEXT                   query(JSON string)  [required]
  --format [jsonpath|jsonpointer]
  --key [eq|is|in1|in2|match|sub|eval|fnmatch|range]
  --value [eq|is|in1|in2|match|sub|eval|fnmatch|range]
  --mode [sub|super|set]
  --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'

links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

jsonfind-0.1.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file jsonfind-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: jsonfind-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using 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.2 CPython/3.8.0

File hashes

Hashes for jsonfind-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e09eca685c5c83fcf17636e2060f6a5bbfac803adfdd5033ffa174887aa97174
MD5 94589363908cc18dd85fc372a107b780
BLAKE2b-256 595ebbf58c6b2adfbfbaf1e80299c30f8a6450590adae1abaabd30d4172f490b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page