Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: command line interface #26

Merged
merged 7 commits into from
Jul 15, 2023
Merged

feat: command line interface #26

merged 7 commits into from
Jul 15, 2023

Conversation

jg-rp
Copy link
Owner

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

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
34 checks passed
@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