mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-11 07:58:33 +00:00
Update cheatsheets
This commit is contained in:
25
ajson
Normal file
25
ajson
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, common]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# 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 * $}}'`
|
||||
Reference in New Issue
Block a user