Metadata-Version: 2.1
Name: jsonfind
Version: 0.1.1
Summary: search dict
Home-page: https://github.com/wtnb75/jsonfind
Author: Takashi WATANABE
Author-email: wtnb75@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Description-Content-Type: text/markdown
Requires-Dist: Click
Requires-Dist: jsonpath
Requires-Dist: jsonpointer
Provides-Extra: dev
Requires-Dist: dirimport ; extra == 'dev'
Requires-Dist: nose ; extra == 'dev'
Requires-Dist: coverage ; extra == 'dev'
Requires-Dist: wheel ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'
Requires-Dist: pip2pi ; extra == 'dev'

# 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'
```

# links

- [pypi repository](https://pypi.org/project/jsonfind/)
- [coverage report](https://wtnb75.github.io/jsonfind/)
- [local pypi repository](https://wtnb75.github.io/jsonfind/dist/)


