jo
Create JSON objects from command-line arguments
SYNOPSIS
jo [options] [key=value ...]
PARAMETERS
-a
Create a JSON array from the remaining arguments. Each argument is treated as an element of the array.
-b
Treat arguments named 'true' or 'false' as boolean values instead of strings.
-n
Treat arguments named 'null' as NULL values instead of strings.
-p
Pretty-print the JSON output with indentation. Makes the output more human-readable.
-s
Sort the keys alphabetically in the output JSON object.
-v
Show version information and exit.
-h
Display help message and exit.
DESCRIPTION
The jo command is a simple tool that creates JSON objects from command-line arguments. It takes key-value pairs or an array of values as input and outputs a corresponding JSON string to standard output. This makes it very useful for generating JSON data directly from shell scripts for use in other applications or services. jo supports different data types like strings, numbers, booleans and nested structures. It can also be used to create arrays of values.
jo helps in generating formatted output for integration with APIs or configuration files that require JSON format.
CAVEATS
jo relies on the format of the input to determine data types. Ensure your input matches the intended data types (e.g., use the -b flag for booleans).
EXAMPLES
Create a JSON object with key-value pairs:jo name=John age=30 city=NewYork
Create a JSON array:jo -a 1 2 3 4 5
Create a pretty-printed JSON object:jo -p name=John age=30 city=NewYork
Create an object with a boolean value:jo -b is_active=true name=John
HISTORY
jo was created to simplify JSON generation from shell scripts. Its development focuses on providing a lightweight and straightforward way to construct JSON data directly from the command line. Its usage has grown as JSON became a standard data interchange format, making it easy to interact with web services and configuration files.