JSON CLI Parser (jc) - Convert Command Output to JSON

Convert command-line output to JSON with jc, a powerful JSON CLI parser. Easily parse system commands like ls, df, ps, and more into structured JSON for further processing.

jc - JSON CLI Parser

What is jc?

jc is a powerful command-line utility designed to parse the output of various system commands and convert them into structured JSON format. This makes it incredibly useful for developers and system administrators who need to process command-line data programmatically. By transforming raw text output into JSON, jc enables seamless integration with scripting languages, data analysis tools, and other JSON-aware applications. It supports a wide range of common commands, including ls, df, ps, and many more, simplifying complex data extraction tasks.

Key Features and Usage

jc simplifies the process of converting command-line output into JSON. Here are some common use cases:

Parsing Command Output

You can pipe the output of any supported command directly to jc to get JSON output.

# Convert the output of a command to JSON
some_command | jc --some_command

Parsing File Contents

jc can also parse the contents of files directly.

# Parse file contents into JSON
jc --some_command -i somefile

Using with Sudo

For commands that require elevated privileges, you can use jc with sudo.

# Use with sudo to parse command output that requires elevated permissions
sudo some_command | jc --some_command

Parsing System Commands

jc excels at parsing common system command outputs.

# Parse system command outputs (e.g., `ls`, `df`, `ps`) into JSON
ls -l | jc --ls

Direct Input Parsing

You can also use shell input redirection for parsing.

# Use jc with various supported commands directly
jc --ls <<< "$(ls -l)"

Specifying Input and Output

For more control, you can specify input and output methods.

# Parse file outputs by specifying input and output
jc -i ls somefile.txt

Chaining with Other Tools

The JSON output from jc can be easily piped to other JSON processing tools like jq.

# Chain with other commands for JSON processing
ls -l | jc --ls | jq '.'

Getting Help

jc provides help for its specific parsers.

# Help command for specific parsers
jc -h ls

Getting Version Information

Check the installed version of jc.

# Get version of jc
jc --version

External Resources