@@ -11,13 +11,23 @@ By design it's compilable as native executable using GraalVM, and as such offers
11
11
12
12
The jsonata CLI can be installed with homebrew:
13
13
```
14
- % brew install dashjoin/tap/jsonata
14
+ brew install dashjoin/tap/jsonata
15
15
```
16
16
The brew installation requires an installed Java runtime (` brew install java ` ).
17
+ We left out the dependency from brew so you can use any Java runtime you like.
18
+
19
+ ## Update
20
+
21
+ If installed with homebrew, you can update with
22
+ ```
23
+ brew upgrade jsonata
24
+ ```
25
+
26
+ # JSONata Command Line Interface
17
27
18
28
```
19
29
% jsonata
20
- JSONata CLI by Dashjoin (https://dashjoin.com)
30
+ JSONata CLI version 0.9.5-0.4 by Dashjoin (https://dashjoin.com)
21
31
22
32
CLI for the JSONata query and transformation language.
23
33
More information at https://github.com/dashjoin/jsonata-cli
@@ -31,21 +41,34 @@ usage: jsonata [options] <expression>
31
41
-bf,--bindings-file <file> JSONata variable bindings file
32
42
-c,--compact Compact JSON output (don't prettify)
33
43
-e,--expression <file> JSONata expression file to evaluate
44
+ -f,--format <arg> Input format (default=auto)
34
45
-h,--help Display help and version info
35
46
-i,--input <arg> JSON input file (- for stdin)
47
+ -ic,--icharset <arg> Input character set (default=UTF-8)
36
48
-o,--output <arg> JSON output file (default=stdout)
49
+ -oc,--ocharset <arg> Output character set (default=UTF-8)
37
50
-time Print performance timers to stderr
38
51
-v,--version Display version info
39
52
```
40
53
41
54
# Examples
42
55
```
43
- % echo '{"a":"hello", "b":" world"}' | jsonata -i - '(a & b)'
56
+ % echo '{"a":"hello", "b":" world"}' | jsonata '(a & b)'
44
57
hello world
45
58
46
- % echo '{"a":"hello", "b":" world"}' | jsonata -i - -o helloworld.json $
59
+ % echo '{"a":"hello", "b":" world"}' | jsonata -o helloworld.json $
60
+ # helloworld.json written
61
+
62
+ % ls | jsonata $
63
+ Applications
64
+ Library
65
+ System
66
+ ...
67
+
68
+ % ps -o pid="",%cpu="",%mem="" | jsonata '$.$split(/\n/).$trim().[ $split(/\s+/).$number() ]' -c
69
+ [[1,3.2,0.1],[382,0,0],[501,0.5,0.1],[502,0,0],...
47
70
48
- % curl -s https://raw.githubusercontent.com/jsonata-js/jsonata/master/test/test-suite/datasets/dataset1.json | jsonata -i - '{"Name": FirstName & " " & Surname, "Cities": **.City, "Emails": Email[type="home"].address}'
71
+ % curl -s https://raw.githubusercontent.com/jsonata-js/jsonata/master/test/test-suite/datasets/dataset1.json | jsonata '{"Name": FirstName & " " & Surname, "Cities": **.City, "Emails": Email[type="home"].address}'
49
72
{
50
73
"Name": "Fred Smith",
51
74
"Cities": [
0 commit comments