Registry / data / jc
library1.25.6pypypi✓ verified 84d ago

jc is a CLI tool and Python library that converts the output of popular command-line tools and file-types to JSON, YAML, or Python dictionaries. This allows for easier parsing in scripts and seamless integration with tools like `jq`. The library is actively maintained with frequent releases, typically on a monthly or bi-monthly cadence.

pip install jc
INSTALL
IMPORT
SIG · JC
J
jc
datapythonv1.25.6
Install
2.8s avg
Import
32ms
Disk
32MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.25.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.033s · 33.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.8s · import 0.031s · 34MB
32MB installed
● package 32MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

jc
import jc
Most common and recommended way to access the high-level parsing API.
jc.parsers.<parser_name>
import jc.parsers.dig
For directly importing specific parser modules, bypassing the high-level API.

This quickstart demonstrates how to use `jc` to parse the output of a command-line tool. It captures command output using `subprocess.check_output` and then uses `jc.parse()` with the appropriate parser name ('dig', 'df') to convert it into a Python dictionary or list of dictionaries.

import subprocess import jc # Example: Parse 'dig example.com' output cmd_output = subprocess.check_output(['dig', 'example.com'], text=True) data = jc.parse('dig', cmd_output) # The result is a Python list of dictionaries print(data[0]['answer']) # Example: Parse 'df' output df_output = subprocess.check_output(['df', '-h'], text=True) df_data = jc.parse('df', df_output) print(df_data[0]['filesystem'])
jc --version
Debug
Known issues
breakingThe `iso-datetime` parser was removed. Use `datetime-iso` instead.
fix
Replace `jc.parse('iso-datetime', ...)` with `jc.parse('datetime-iso', ...)`.
affects: v1.24.0 and later (deprecated since v1.22.1)
gotchaThe `size` fields in `df` and `free` parsers were changed to integers and normalized to bytes, regardless of whether human-readable output (`-h`) was used in the original command. Previously, they might have been strings with units.
fix
Update scripts that expect `size` as a string or in specific units to handle the new integer (byte) format. Perform explicit unit conversion if human-readable output is desired.
affects: v1.25.2 and later
gotchaAttempting to use parsers that rely on optional third-party libraries (e.g., `xmltodict` for XML parsing) without those libraries installed will result in an `ImportError` or a crash.
fix
Ensure all necessary optional dependencies are installed via `pip install jc[xml]` (if extras are defined) or `pip install <dependency_name>` if you plan to use parsers requiring them. For `xmltodict`, install with `pip install xmltodict`.
affects: All versions
gotchaThe `--slurp` functionality (or `slurp=True` in `jc.parse()`) only works with parsers designed for single-line inputs, not with streaming parsers. Using it with unsupported parsers will not yield the expected results.
fix
Check `jc -hhh` on the command line or refer to the documentation to identify parsers compatible with the `--slurp` option before using it.
affects: v1.25.0 and later
Errors
Common errors & fixes
jc: command not found
The `jc` command-line tool is not found in your system's PATH. This usually happens if `jc` was installed via `pip` but the Python scripts directory is not included in your shell's PATH environment variable, or if installation was incomplete.
fix
Ensure `jc` is installed (`pip install jc`) and that your shell's PATH includes the directory where pip installs executables (e.g., `~/.local/bin` on Linux/macOS or `Scripts` folder in Python installation on Windows). You might need to restart your terminal or source your shell's configuration file (e.g., `source ~/.bashrc` or `source ~/.zshrc`).
ModuleNotFoundError: No module named 'jc'
The Python interpreter cannot find the `jc` library. This means the library is either not installed in the currently active Python environment, or there's a problem with the Python path.
fix
Install the `jc` library using pip: `pip install jc`. If you are using virtual environments, ensure your environment is activated before installation. If already installed, verify you are running your script with the correct Python interpreter where `jc` is installed.
You must specify a parser for the jc outputter by exporting the JC_PARSER env variable.
When using `jc` in certain contexts (like a SaltStack outputter, as seen in search results) or when calling `jc.parse()` without a parser, the library requires explicit specification of which parser to use for the input data.
fix
When using the `jc` CLI, specify the parser using the `--parser_name` option (e.g., `ls -l | jc --ls`). When using the Python library, ensure you pass the correct parser name as the first argument to `jc.parse()` (e.g., `jc.parse('ls', cmd_output)`).
jq: error (at <stdin>:1): Cannot index array with string "Date"
This specific error often occurs when `jc --csv` is used on a CSV file that contains a Byte Order Mark (BOM) at the beginning. The BOM can cause the first column header to be parsed with extraneous hidden characters, leading `jq` to fail when trying to access the column by its expected name.
fix
Upgrade `jc` to a version that handles BOMs in CSV files (version 1.22.2 or newer is recommended). `pip install --upgrade jc`. Alternatively, ensure your CSV files do not contain a BOM.
Upgrade
Version history
1.25.6latest on PyPI · released Oct 13, 2025
Audit
Dependencies
xmltodictoptionalRequired for parsing XML files. If not installed, parsing XML will raise an ImportError.
ruamel.yamloptionalRequired for YAML output functionality.
Agent activity
9 hits · last 30 days
node
8
Resources
jc — pip install jc · libregistry