Repolode
kellyjonbrazil

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. 1

    Install jc with pip

    pip3 install jc
  2. 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