From 3cff0e39145da3cc84c11fba6e03c22448520b7f Mon Sep 17 00:00:00 2001 From: Stepan Pyzhov <32341341+spyzhov@users.noreply.github.com> Date: Fri, 17 Jul 2020 19:43:24 +0200 Subject: [PATCH] ajson: add page (#4191) --- pages/common/ajson.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 pages/common/ajson.md diff --git a/pages/common/ajson.md b/pages/common/ajson.md new file mode 100644 index 0000000000..cf060c3203 --- /dev/null +++ b/pages/common/ajson.md @@ -0,0 +1,20 @@ +# ajson + +> Executes JSONPath on JSON objects. +> More information: . + +- 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 * $}}'`