JOSE-FMT(1)

πŸ’– NAME πŸ’–

okay bestie, welcome to the JOSE-FMT(1) manual page for jose-fmt β€” it Converts JSON between serialization formats ✨

✨ SYNOPSIS ✨

jose fmt [OPTIONS]

πŸŽ€ OVERVIEW πŸŽ€

So the jose fmt command is your little command-line machine for building and parsing JSON objects. It operates as a simple stack machine, no cap 🫢

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. Slay.

🌈 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>


okay that’s the whole JOSE-FMT(1) manual page, dated 06/09/2026 β€” bye bestie, go slay your JSON πŸ’…βœ¨

πŸ“¦ where this page comes from