jo

creates JSON from shell arguments

TLDR

Create JSON object
$ jo name=[value] count:=[42]
Create JSON array
$ jo -a [item1] [item2] [item3]
Nested objects
$ jo name=[test] config=$(jo debug:=[true])
Read from stdin
$ echo "[value]" | jo name=@-
Read from file
$ jo content=@[file.txt]
Pretty print
$ jo -p name=[value]

SYNOPSIS

jo [options] [key=value...]

DESCRIPTION

jo creates JSON from shell arguments. It builds objects and arrays from command-line key-value pairs.The tool enables JSON generation in shell scripts. Type hints distinguish strings from numbers and booleans.

PARAMETERS

KEY=VALUE

String value assignment.
KEY:=VALUE
Non-string value (number, boolean, null).
-a
Create array instead of object.
-p
Pretty print output.
@FILE
Read value from file.
@-
Read value from stdin.
--help
Display help information.

INSTALL

sudo apt install jo
sudo dnf install jo
sudo pacman -S jo
sudo apk add jo
sudo zypper install jo
brew install jo
nix profile install nixpkgs#jo

CAVEATS

Shell quoting important. Use := for non-strings. Nested structures via subshell.

HISTORY

jo was created by Jan-Piet Mens to simplify JSON creation in shell scripts without complex quoting.

SEE ALSO

jq(1), jc(1), gron(1)