123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- .\" generated with Ronn/v0.7.3
- .\" http://github.com/rtomayko/ronn/tree/0.7.3
- .
- .TH "JOSE\-FMT" "1" "June 2017" "" ""
- .
- .SH "NAME"
- \fBjose\-fmt\fR \- Converts JSON between serialization formats
- .
- .SH "SYNOPSIS"
- \fBjose fmt\fR \fIOPTIONS\fR
- .
- .SH "OVERVIEW"
- This \fBjose fmt\fR command provides a mechanism for building and parsing JSON objects from the command line\. It operates as a simple stack machine\. All commands operate on the TOP item of the stack and, occasionally, the PREV item of the stack\. Commands that require a specific type of value will indicate it in parentheses\. For example: "TOP (arr\.)"\.
- .
- .P
- This program returns 0 on success or the index of the option which failed\.
- .
- .SH "OPTIONS"
- .
- .TP
- \fB\-X\fR, \fB\-\-not\fR
- Invert the following assertion
- .
- .TP
- \fB\-O\fR, \fB\-\-object\fR
- Assert TOP to be an object
- .
- .TP
- \fB\-A\fR, \fB\-\-array\fR
- Assert TOP to be an array
- .
- .TP
- \fB\-S\fR, \fB\-\-string\fR
- Assert TOP to be a string
- .
- .TP
- \fB\-I\fR, \fB\-\-integer\fR
- Assert TOP to be an integer
- .
- .TP
- \fB\-R\fR, \fB\-\-real\fR
- Assert TOP to be a real
- .
- .TP
- \fB\-N\fR, \fB\-\-number\fR
- Assert TOP to be a number
- .
- .TP
- \fB\-T\fR, \fB\-\-true\fR
- Assert TOP to be true
- .
- .TP
- \fB\-F\fR, \fB\-\-false\fR
- Assert TOP to be false
- .
- .TP
- \fB\-B\fR, \fB\-\-boolean\fR
- Assert TOP to be a boolean
- .
- .TP
- \fB\-0\fR, \fB\-\-null\fR
- Assert TOP to be null
- .
- .TP
- \fB\-E\fR, \fB\-\-equal\fR
- Assert TOP to be equal to PREV
- .
- .TP
- \fB\-Q\fR, \fB\-\-query\fR
- Query the stack by deep copying and pushing onto TOP
- .
- .TP
- \fB\-M\fR #, \fB\-\-move\fR=#
- Move TOP back # places on the stack
- .
- .TP
- \fB\-U\fR, \fB\-\-unwind\fR
- Discard TOP from the stack
- .
- .TP
- \fB\-j\fR \fIJSON\fR, \fB\-\-json\fR=\fIJSON\fR
- Parse JSON constant, push onto TOP
- .
- .TP
- \fB\-j\fR \fIFILE\fR, \fB\-\-json\fR=\fIFILE\fR
- Read from FILE, push onto TOP
- .
- .TP
- \fB\-j\fR \-, \fB\-\-json\fR=\-
- Read from STDIN, push onto TOP
- .
- .TP
- \fB\-c\fR, \fB\-\-copy\fR
- Deep copy TOP, push onto TOP
- .
- .TP
- \fB\-q\fR \fISTR\fR, \fB\-\-quote\fR=\fISTR\fR
- Convert STR to a string, push onto TOP
- .
- .TP
- \fB\-o\fR \fIFILE\fR, \fB\-\-output\fR=\fIFILE\fR
- Write TOP to FILE
- .
- .TP
- \fB\-o\fR \-, \fB\-\-output\fR=\-
- Write TOP to STDOUT
- .
- .TP
- \fB\-f\fR \fIFILE\fR, \fB\-\-foreach\fR=\fIFILE\fR
- Write TOP (obj\./arr\.) to FILE, one line/item
- .
- .TP
- \fB\-f\fR \-, \fB\-\-foreach\fR=\-
- Write TOP (obj\./arr\.) to STDOUT, one line/item
- .
- .TP
- \fB\-u\fR \fIFILE\fR, \fB\-\-unquote\fR=\fIFILE\fR
- Write TOP (str\.) to FILE without quotes
- .
- .TP
- \fB\-u\fR \-, \fB\-\-unquote\fR=\-
- Write TOP (str\.) to STDOUT without quotes
- .
- .TP
- \fB\-t\fR #, \fB\-\-truncate\fR=#
- Shrink TOP (arr\.) to length #
- .
- .TP
- \fB\-t\fR \-#, \fB\-\-truncate\fR=\-#
- Discard last # items from TOP (arr\.)
- .
- .TP
- \fB\-i\fR #, \fB\-\-insert\fR=#
- Insert TOP into PREV (arr\.) at #
- .
- .TP
- \fB\-a\fR, \fB\-\-append\fR
- Append TOP to the end of PREV (arr\.)
- .
- .TP
- \fB\-a\fR, \fB\-\-append\fR
- Set missing values from TOP (obj\.) into PREV (obj\.)
- .
- .TP
- \fB\-x\fR, \fB\-\-extend\fR
- Append items from TOP to the end of PREV (arr\.)
- .
- .TP
- \fB\-x\fR, \fB\-\-extend\fR
- Set all values from TOP (obj\.) into PREV (obj\.)
- .
- .TP
- \fB\-d\fR \fINAME\fR, \fB\-\-delete\fR=\fINAME\fR
- Delete NAME from TOP (obj\.)
- .
- .TP
- \fB\-d\fR #, \fB\-\-delete\fR=#
- Delete # from TOP (arr\.)
- .
- .TP
- \fB\-d\fR \-#, \fB\-\-delete\fR=\-#
- Delete # from the end of TOP (arr\.)
- .
- .TP
- \fB\-l\fR, \fB\-\-length\fR
- Push length of TOP (arr\./str\./obj\.) to TOP
- .
- .TP
- \fB\-e\fR, \fB\-\-empty\fR
- Erase all items from TOP (arr\./obj\.)
- .
- .TP
- \fB\-g\fR \fINAME\fR, \fB\-\-get\fR=\fINAME\fR
- Get item with NAME from TOP (obj\.), push to TOP
- .
- .TP
- \fB\-g\fR #, \fB\-\-get\fR=#
- Get # item from TOP (arr\.), push to TOP
- .
- .TP
- \fB\-g\fR \-#, \fB\-\-get\fR=\-#
- Get # item from the end of TOP (arr\.), push to TOP
- .
- .TP
- \fB\-s\fR \fINAME\fR, \fB\-\-set\fR=\fINAME\fR
- Sets TOP into PREV (obj\.) with NAME
- .
- .TP
- \fB\-s\fR #, \fB\-\-set\fR=#
- Sets TOP into PREV (obj\.) at #
- .
- .TP
- \fB\-s\fR \-#, \fB\-\-set\fR=\-#
- Sets TOP into PREV (obj\.) at # from the end
- .
- .TP
- \fB\-y\fR, \fB\-\-b64load\fR
- URL\-safe Base64 decode TOP (str\.), push onto TOP
- .
- .TP
- \fB\-Y\fR, \fB\-\-b64dump\fR
- URL\-safe Base64 encode TOP, push onto TOP
- .
- .SH "EXAMPLES"
- Extract the \fBalg\fR parameter from a JWE Protected Header:
- .
- .IP "" 4
- .
- .nf
- $ jose fmt \-j "$jwe" \-Og protected \-yOg alg \-Su\-
- A128KW
- .
- .fi
- .
- .IP "" 0
- .
- .P
- List all JWKs in a JWKSet (one per line):
- .
- .IP "" 4
- .
- .nf
- $ echo "$jwkset" | jose fmt \-j\- \-Og keys \-Af\-
- {"kty":"oct",\.\.\.}
- {"kty":"EC",\.\.\.}
- .
- .fi
- .
- .IP "" 0
- .
- .P
- Change the algorithm in a JWK:
- .
- .IP "" 4
- .
- .nf
- $ echo "$jwk" | jose fmt \-j\- \-j \'"A128GCM"\' \-s alg \-Uo\-
- {"kty":"oct","alg":"A128GCM",\.\.\.}
- .
- .fi
- .
- .IP "" 0
- .
- .P
- Build a JWE template:
- .
- .IP "" 4
- .
- .nf
- $ jose fmt \-j \'{}\' \-cs unprotected \-q A128KW \-s alg \-UUo\-
- {"unprotected":{"alg":"A128KW"}}
- .
- .fi
- .
- .IP "" 0
- .
- .SH "AUTHOR"
- Nathaniel McCallum <npmccallum@redhat\.com>
|