ajson: add page (#4191)

This commit is contained in:
Stepan Pyzhov 2020-07-17 19:43:24 +02:00 committed by GitHub
parent b22f908ca4
commit 3cff0e3914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

20
pages/common/ajson.md Normal file
View File

@ -0,0 +1,20 @@
# ajson
> Executes JSONPath on JSON objects.
> More information: <https://github.com/spyzhov/ajson>.
- Read JSON from a file and execute a specified JSONPath expression:
`ajson '{{$..json[?(@.path)]}}' {{path/to/file.json}}`
- Read JSON from stdin and execute a specified JSONPath expression:
`cat {{path/to/file.json}} | ajson '{{$..json[?(@.path)]}}'`
- Read JSON from a URL and evaluate a specified JSONPath expression:
`ajson '{{avg($..price)}}' '{{https://example.com/api/}}'`
- Read some simple JSON and calculate a value:
`echo '{{3}}' | ajson '{{2 * pi * $}}'`