Skip to content

Commit daf98f6

Browse files
committed
Update for 0.4, added examples with string input
1 parent 08dd2a4 commit daf98f6

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,23 @@ By design it's compilable as native executable using GraalVM, and as such offers
1111

1212
The jsonata CLI can be installed with homebrew:
1313
```
14-
% brew install dashjoin/tap/jsonata
14+
brew install dashjoin/tap/jsonata
1515
```
1616
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
1727

1828
```
1929
% jsonata
20-
JSONata CLI by Dashjoin (https://dashjoin.com)
30+
JSONata CLI version 0.9.5-0.4 by Dashjoin (https://dashjoin.com)
2131
2232
CLI for the JSONata query and transformation language.
2333
More information at https://github.com/dashjoin/jsonata-cli
@@ -31,21 +41,34 @@ usage: jsonata [options] <expression>
3141
-bf,--bindings-file <file> JSONata variable bindings file
3242
-c,--compact Compact JSON output (don't prettify)
3343
-e,--expression <file> JSONata expression file to evaluate
44+
-f,--format <arg> Input format (default=auto)
3445
-h,--help Display help and version info
3546
-i,--input <arg> JSON input file (- for stdin)
47+
-ic,--icharset <arg> Input character set (default=UTF-8)
3648
-o,--output <arg> JSON output file (default=stdout)
49+
-oc,--ocharset <arg> Output character set (default=UTF-8)
3750
-time Print performance timers to stderr
3851
-v,--version Display version info
3952
```
4053

4154
# Examples
4255
```
43-
% echo '{"a":"hello", "b":" world"}' | jsonata -i - '(a & b)'
56+
% echo '{"a":"hello", "b":" world"}' | jsonata '(a & b)'
4457
hello world
4558
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],...
4770
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}'
4972
{
5073
"Name": "Fred Smith",
5174
"Cities": [

0 commit comments

Comments
 (0)