A declarative Go package for building command line tools, with subcommands, flags, shell completion and help generation.
kellyjonbrazil/jc
A CLI tool and Python library that converts the output of common command-line tools, file types, and strings into JSON, YAML, or dictionaries.
- Stars
- 8,694
- Forks
- 269
- Open issues
- 29
- Last commit
- 3 days ago
What is it?
jc converts the text output of many common Linux, macOS, and Windows command-line tools, such as dig, ls, ps, df, and netstat, into structured JSON. It also parses common file formats like CSV, INI, YAML, TOML, and X.509 certificates, plus strings such as URLs, IP addresses, JWTs, and timestamps. Each parser follows a defined schema and converts known numbers, booleans, and null values to their proper JSON types.
The output can be piped into tools like jq or jello, or invoked with a "magic" syntax that places jc directly before a command. Developers can also use jc as a Python library, where parse() returns dictionaries or lazy iterables of dictionaries. A raw mode is available for the unprocessed JSON.
The project is installable with pip and is available through many OS package managers. It is also packaged as an Ansible filter plugin in the community.general collection.
Key features
- 01Converts output from many command-line tools into JSON with a fixed schema per parser.
- 02Parses common file formats and strings such as CSV, YAML, TOML, URLs, and JWTs.
- 03Works in shell pipelines with tools like jq, or as a Python library returning dictionaries.
- 04Offers streaming parsers for some commands to process large output lazily.
- 05Installable via pip, OS package managers, or prebuilt binaries.
Use cases
- Parsing command output in Bash scripts without fragile text-processing code.
- Extracting fields from system commands in Ansible, Salt, or Nornir automation.
- Converting configuration or log files into JSON for further analysis.
- Feeding network or system diagnostics into Python data pipelines.
Quick start
- 1
Install jc with pip
pip3 install jc - 2
Pipe command output into jc with a parser, e.g. dig
dig example.com | jc --dig
Things to know
- Output is only as complete as each parser's supported schema; unsupported commands are not converted.
Topics
FAQ
- What is jc?
- A CLI tool and Python library that converts the output of common command-line tools, file types, and strings into JSON, YAML, or dictionaries. jc converts the text output of many common Linux, macOS, and Windows command-line tools, such as dig, ls, ps, df, and netstat, into structured JSON. It also parses common file formats like CSV, INI, YAML, TOML, and X.509 certificates, plus strings such as URLs, IP addresses, JWTs, and timestamps. Each parser follows a defined schema and converts known numbers, booleans, and null values to their proper JSON types.
- Is jc free to use? What license does it have?
- jc is open source under the MIT license. Check the license terms before using it in commercial products.
- Is jc still maintained?
- Actively maintained. The last commit to jc was on Oct 20, 2026.
- What can I use jc for?
- Parsing command output in Bash scripts without fragile text-processing code. Extracting fields from system commands in Ansible, Salt, or Nornir automation. Converting configuration or log files into JSON for further analysis. Feeding network or system diagnostics into Python data pipelines.
- How do I install jc?
- Install jc with pip: pip3 install jc Pipe command output into jc with a parser, e.g. dig: dig example.com | jc --dig
- Where can I get jc?
- The source code and installation instructions are on GitHub: https://github.com/kellyjonbrazil/jc
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A terminal JSON viewer and processor that lets you browse, fold and transform JSON interactively in the shell.
Open-source JSON editor that turns JSON, YAML, CSV and XML into interactive graphs, with format conversion and code generation.
An open-source, AI-integrated terminal for macOS, Linux and Windows that supports BYOK and local models, durable SSH sessions and inline file previews.
A command-line ping tool that graphs round-trip times for multiple hosts, or execution times for commands, in the terminal.
A fast Python serialization and validation library that encodes and decodes JSON, MessagePack, YAML, and TOML using standard type annotations.