Skip to content

feat: command line interface - #26

Merged
jg-rp merged 7 commits into
mainfrom
cli
Jul 15, 2023
Merged

jg-rp merged 7 commits into
mainfrom
cli

Conversation

@jg-rp

@jg-rp jg-rp commented Jul 12, 2023 •

Copy link
Copy Markdown
Owner

This pull request adds a command line interface, exposing JSONPath, JSON Pointer and JSON Patch features. Closes #16.

We define a json entry point, as well as a package __main__.py (python -m jsonpath).

Example usage:

Find objects in source.json matching a JSONPath, write them to result.json.

$ json path -q "$.foo['bar'][[email protected] > 1]" -f source.json -o result.json

Resolve a JSON Pointer against source.json, pretty print the result to stdout.

$ json --pretty pointer -p "/foo/bar/0" -f source.json

Apply JSON Patch patch.json to JSON from stdin, output to result.json.

$ cat source.json | json patch /path/to/patch.json -o result.json

@jg-rp
jg-rp marked this pull request as ready for review July 14, 2023 12:11
@jg-rp
jg-rp merged commit be219c3 into main Jul 15, 2023
@jg-rp
jg-rp deleted the cli branch July 15, 2023 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Command Line Interface

1 participant