DOKK / manpages / debian 10 / jose / jose-fmt.1.en
JOSE-FMT(1) JOSE-FMT(1)

jose-fmt - Converts JSON between serialization formats

jose fmt OPTIONS

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.

Invert the following assertion
Assert TOP to be an object
Assert TOP to be an array
Assert TOP to be a string
Assert TOP to be an integer
Assert TOP to be a real
Assert TOP to be a number
Assert TOP to be true
Assert TOP to be false
Assert TOP to be a boolean
-0, --null
Assert TOP to be null
Assert TOP to be equal to PREV
Query the stack by deep copying and pushing onto TOP
Move TOP back # places on the stack
Discard TOP from the stack
Parse JSON constant, push onto TOP
Read from FILE, push onto TOP
Read from STDIN, push onto TOP
Deep copy TOP, push onto TOP
Convert STR to a string, push onto TOP
Write TOP to FILE
Write TOP to STDOUT
Write TOP (obj./arr.) to FILE, one line/item
Write TOP (obj./arr.) to STDOUT, one line/item
Write TOP (str.) to FILE without quotes
Write TOP (str.) to STDOUT without quotes
Shrink TOP (arr.) to length #
Discard last # items from TOP (arr.)
Insert TOP into PREV (arr.) at #
Append TOP to the end of PREV (arr.)
Set missing values from TOP (obj.) into PREV (obj.)
Append items from TOP to the end of PREV (arr.)
Set all values from TOP (obj.) into PREV (obj.)
Delete NAME from TOP (obj.)
Delete # from TOP (arr.)
Delete # from the end of TOP (arr.)
Push length of TOP (arr./str./obj.) to TOP
Erase all items from TOP (arr./obj.)
Get item with NAME from TOP (obj.), push to TOP
Get # item from TOP (arr.), push to TOP
Get # item from the end of TOP (arr.), push to TOP
Sets TOP into PREV (obj.) with NAME
Sets TOP into PREV (obj.) at #
Sets TOP into PREV (obj.) at # from the end
URL-safe Base64 decode TOP (str.), push onto TOP
URL-safe Base64 encode TOP, push onto TOP

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"}}

Nathaniel McCallum <npmccallum@redhat.com>

June 2017