jo
Create JSON objects from command-line arguments
TLDR
View documentation for the original command
SYNOPSIS
jo [OPTION]... [KEY[=VALUE] ...]
PARAMETERS
-a, --array
Output a JSON array (default: object)
-p, --pretty
Pretty-print with indentation
-B, --bare
Omit trailing newline
-n, --null
Convert empty strings to null
-N, --nullish
Convert empty/unset values to null
-s, --string
Force all values as strings
-S, --sort
Sort object keys alphabetically
-f, --file FILE
Read key=value from file
-u, --utf8
Assume UTF-8 input (default)
-h, --help
Display help
-V, --version
Show version
DESCRIPTION
jo is a lightweight command-line tool designed to simplify the creation of JSON output directly from shell scripts or command-line arguments. It converts key=value pairs, positional arguments, or even file contents into valid JSON objects or arrays, making it ideal for generating structured data for APIs, logging, configuration files, or piping into tools like jq.
Usage is straightforward: simply invoke jo key1=value1 key2=value2 to produce {"key1":"value1","key2":"value2"}. It handles quoting automatically, treats unset variables specially, and supports common data types like strings, numbers, booleans, and nulls. Features include pretty-printing for readability, sorting keys alphabetically, and options to treat empty values as null.
This utility shines in automation tasks where shell variables need quick JSON serialization without complex scripting. It's fast, has no external dependencies beyond standard C libraries, and is particularly useful in environments like Docker, CI/CD pipelines, or monitoring systems where JSON is the de facto interchange format.
CAVEATS
Does not support nested objects/arrays directly (use piping with multiple jo invocations); limited to basic types; large inputs may require careful memory handling.
EXAMPLES
jo name=John age=30 city="New York"
{"name":"John","age":30,"city":"New York"}
jo -a $(seq 3)
[1,2,3]
jo -p -S foo=1 bar=2
{
"bar": 2,
"foo": 1
}
HISTORY
Developed by Michael Hendry in 2017 as a minimalist JSON emitter for shell scripting. First released on GitHub; now packaged in major distros like Debian, Fedora, and Alpine since ~2018. Focuses on speed and simplicity over feature bloat.


