123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- jose-fmt(1)
- ===========
- :doctype: manpage
- == NAME
- jose-fmt - Converts JSON between serialization formats
- == SYNOPSIS
- *jose fmt* [OPTIONS]
- == OVERVIEW
- This *jose fmt* 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.)".
- This program returns 0 on success or the index of the option which failed.
- == OPTIONS
- * *-0*, *--null* :
- Assert TOP to be null
- * *-a*, *--append* :
- Append TOP to the end of PREV (arr.)
- * *-a*, *--append* :
- Set missing values from TOP (obj.) into PREV (obj.)
- * *-A*, *--array* :
- Assert TOP to be an array
- * *-B*, *--boolean* :
- Assert TOP to be a boolean
- * *-c*, *--copy* :
- Deep copy TOP, push onto TOP
- * *-d* _NAME_, *--delete*=_NAME_ :
- Delete NAME from TOP (obj.)
- * *-d* #, *--delete*=# :
- Delete # from TOP (arr.)
- * *-d* -#, *--delete*=-# :
- Delete # from the end of TOP (arr.)
- * *-e*, *--empty* :
- Erase all items from TOP (arr./obj.)
- * *-E*, *--equal* :
- Assert TOP to be equal to PREV
- * *-f* _FILE_, *--foreach*=_FILE_ :
- Write TOP (obj./arr.) to FILE, one line/item
- * *-f* -, *--foreach*=- :
- Write TOP (obj./arr.) to STDOUT, one line/item
- * *-F*, *--false* :
- Assert TOP to be false
- * *-g* _NAME_, *--get*=_NAME_ :
- Get item with NAME from TOP (obj.), push to TOP
- * *-g* #, *--get*=# :
- Get # item from TOP (arr.), push to TOP
- * *-g* -#, *--get*=-# :
- Get # item from the end of TOP (arr.), push to TOP
- * *-i* #, *--insert*=# :
- Insert TOP into PREV (arr.) at #
- * *-I*, *--integer* :
- Assert TOP to be an integer
- * *-j* _JSON_, *--json*=_JSON_ :
- Parse JSON constant, push onto TOP
- * *-j* _FILE_, *--json*=_FILE_ :
- Read from FILE, push onto TOP
- * *-j* -, *--json*=- :
- Read from STDIN, push onto TOP
- * *-l*, *--length* :
- Push length of TOP (arr./str./obj.) to TOP
- * *-M* #, *--move*=# :
- Move TOP back # places on the stack
- * *-N*, *--number* :
- Assert TOP to be a number
- * *-o* _FILE_, *--output*=_FILE_ :
- Write TOP to FILE
- * *-o* -, *--output*=- :
- Write TOP to STDOUT
- * *-O*, *--object* :
- Assert TOP to be an object
- * *-q* _STR_, *--quote*=_STR_ :
- Convert STR to a string, push onto TOP
- * *-Q*, *--query* :
- Query the stack by deep copying and pushing onto TOP
- * *-R*, *--real* :
- Assert TOP to be a real
- * *-s* _NAME_, *--set*=_NAME_ :
- Sets TOP into PREV (obj.) with NAME
- * *-s* #, *--set*=# :
- Sets TOP into PREV (obj.) at #
- * *-s* -#, *--set*=-# :
- Sets TOP into PREV (obj.) at # from the end
- * *-S*, *--string* :
- Assert TOP to be a string
- * *-t* #, *--truncate*=# :
- Shrink TOP (arr.) to length #
- * *-t* -#, *--truncate*=-# :
- Discard last # items from TOP (arr.)
- * *-T*, *--true* :
- Assert TOP to be true
- * *-u* _FILE_, *--unquote*=_FILE_ :
- Write TOP (str.) to FILE without quotes
- * *-u* -, *--unquote*=- :
- Write TOP (str.) to STDOUT without quotes
- * *-U*, *--unwind* :
- Discard TOP from the stack
- * *-x*, *--extend* :
- Append items from TOP to the end of PREV (arr.)
- * *-x*, *--extend* :
- Set all values from TOP (obj.) into PREV (obj.)
- * *-X*, *--not* :
- Invert the following assertion
- * *-y*, *--b64load* :
- URL-safe Base64 decode TOP (str.), push onto TOP
- * *-Y*, *--b64dump* :
- URL-safe Base64 encode TOP, push onto TOP
- == EXAMPLES
- Extract the *alg* parameter from a JWE Protected Header:
- $ jose fmt -j "$jwe" -Og protected -yOg alg -Su-
- A128KW
- List all JWKs in a JWKSet (one per line):
- $ echo "$jwkset" | jose fmt -j- -Og keys -Af-
- {"kty":"oct",...}
- {"kty":"EC",...}
- Change the algorithm in a JWK:
- $ echo "$jwk" | jose fmt -j- -j '"A128GCM"' -s alg -Uo-
- {"kty":"oct","alg":"A128GCM",...}
- Build a JWE template:
- $ jose fmt -j '{}' -cs unprotected -q A128KW -s alg -UUo-
- {"unprotected":{"alg":"A128KW"}}
- == AUTHOR
- Nathaniel McCallum <npmccallum@redhat.com>
|