jc(1)

๐ŸŒธ NAME ๐ŸŒธ

Bestie, meet jc(1), aka JSON Convert โ€” the icon that JSONifies the output of many CLI tools, file-types, and strings. ๐Ÿซถ


โœจ SYNOPSIS โœจ

Standard syntax:

COMMAND | jc [SLICE] [OPTIONS] PARSER

cat FILE | jc [SLICE] [OPTIONS] PARSER

echo STRING | jc [SLICE] [OPTIONS] PARSER

Magic syntax:

jc [SLICE] [OPTIONS] COMMAND

jc [SLICE] [OPTIONS] /proc/<path-to-procfile>

๐Ÿ’– DESCRIPTION ๐Ÿ’–

Okay so jc JSONifies the output of many CLI tools, file-types, and common strings so your scripts can parse it way easier. It accepts piped input from STDIN and outputs a JSON representation of the previous command's output to STDOUT. ๐Ÿฆ‹

You can also use the "Magic" syntax by prepending jc to the command you want converted. Options can be passed to jc immediately before the command is given. โœจ

Note: "Magic" syntax does not support shell builtins or command aliases. ๐Ÿ’€

๐Ÿ‘‘ OPTIONS ๐Ÿ‘‘

๐Ÿงš Parsers ๐Ÿงš

  • --acpi โ€” the acpi command parser โœจ
  • --airport โ€” the airport -I command parser โœˆ๏ธ
  • --airport-s โ€” the airport -s command parser โœˆ๏ธ
  • --amixer โ€” the amixer command parser ๐ŸŽš๏ธ
  • --apachectl โ€” the apachectl -S command parser ๐Ÿชถ
  • --apt-cache-show โ€” the apt-cache show command parser ๐Ÿ“ฆ
  • --apt-get-sqq โ€” the apt-get -sqq command parser ๐Ÿ“ฆ
  • --arp โ€” the arp command parser ๐Ÿ•ธ๏ธ
  • --asciitable โ€” the ASCII and Unicode table parser ๐ŸŒˆ
  • --asciitable-m โ€” the multi-line ASCII and Unicode table parser ๐ŸŒˆ
  • --authorized-keys โ€” the ~/.ssh/authorized_keys file parser ๐Ÿ”
  • --blkid โ€” the blkid command parser ๐Ÿ’ฝ
  • --bluetoothctl โ€” the bluetoothctl command parser ๐Ÿฆท
  • --cbt โ€” the cbt (Google Bigtable) command parser โ˜๏ธ
  • --cef โ€” the CEF string parser ๐Ÿงต
  • --cef-s โ€” the CEF string streaming parser ๐ŸŒŠ
  • --certbot โ€” the certbot command parser ๐Ÿ”’
  • --chage โ€” the chage --list command parser โณ
  • --cksum โ€” the cksum and sum command parser ๐Ÿงฎ
  • --clf โ€” the Common and Combined Log Format file parser ๐Ÿ“œ
  • --clf-s โ€” the Common and Combined Log Format file streaming parser ๐ŸŒŠ
  • --conntrack โ€” the conntrack command parser ๐Ÿ”Ž
  • --crontab โ€” the crontab command and file parser ๐Ÿ•ฐ๏ธ
  • --crontab-u โ€” the crontab file parser with user support ๐Ÿ‘ค
  • --csv โ€” the CSV file parser ๐Ÿงพ
  • --csv-ih โ€” the CSV implicit header file parser ๐Ÿงพ
  • --csv-s โ€” the CSV file streaming parser ๐ŸŒŠ
  • --csv-ih-s โ€” the CSV implicit header file streaming parser ๐ŸŒŠ
  • --curl-head โ€” the curl --head command parser ๐ŸŒ€
  • --date โ€” the date command parser ๐Ÿ“…
  • --datetime-iso โ€” the ISO 8601 Datetime string parser ๐Ÿ•ฐ๏ธ
  • --debconf-show โ€” the debconf-show command parser ๐Ÿง
  • --df โ€” the df command parser ๐Ÿ’พ
  • --dig โ€” the dig command parser ๐Ÿ”
  • --dir โ€” the dir command parser ๐Ÿ“
  • --dmidecode โ€” the dmidecode command parser ๐Ÿงฌ
  • --dpkg-l โ€” the dpkg -l command parser ๐Ÿ“ฆ
  • --du โ€” the du command parser ๐Ÿ“
  • --efibootmgr โ€” the efibootmgr command parser ๐Ÿฅพ
  • --email-address โ€” the Email Address string parser ๐Ÿ“ง
  • --env โ€” the env command parser ๐ŸŒฑ
  • --ethtool โ€” the ethtool command parser ๐Ÿ›ฐ๏ธ
  • --file โ€” the file command parser ๐Ÿ“‚
  • --find โ€” the find command parser ๐Ÿ”ญ
  • --findmnt โ€” the findmnt command parser ๐Ÿ—ป
  • --finger โ€” the finger command parser ๐Ÿ‘†
  • --free โ€” the free command parser ๐Ÿ†“
  • --fstab โ€” the /etc/fstab file parser ๐Ÿ—‚๏ธ
  • --getfacl โ€” the getfacl command parser ๐Ÿ”‘
  • --git-diff โ€” the git diff --name-status command parser ๐Ÿง‘โ€๐Ÿ’ป
  • --git-log โ€” the git log command parser ๐Ÿ“œ
  • --git-log-s โ€” the git log command streaming parser ๐ŸŒŠ
  • --git-ls-remote โ€” the git ls-remote command parser ๐ŸŒ
  • --gpg โ€” the gpg --with-colons command parser ๐Ÿ”
  • --group โ€” the /etc/group file parser ๐Ÿ‘ฅ
  • --gshadow โ€” the /etc/gshadow file parser ๐Ÿ•ถ๏ธ
  • --hash โ€” the hash command parser #๏ธโƒฃ
  • --hashsum โ€” the hashsum command parser (md5sum, shasum, etc.) ๐Ÿงฎ
  • --hciconfig โ€” the hciconfig command parser ๐Ÿฆท
  • --history โ€” the history command parser ๐Ÿ•ฐ๏ธ
  • --host โ€” the host command parser ๐Ÿ 
  • --hosts โ€” the /etc/hosts file parser ๐Ÿ 
  • --http-headers โ€” the HTTP headers parser ๐Ÿ“จ
  • --ics โ€” the ics file parser ๐Ÿ“…
  • --id โ€” the id command parser ๐Ÿ†”
  • --ifconfig โ€” the ifconfig command parser ๐ŸŒ
  • --iftop โ€” the iftop command parser ๐Ÿ“ˆ
  • --ini โ€” the INI file parser ๐Ÿ—‚๏ธ
  • --ini-dup โ€” the INI with duplicate key file parser ๐Ÿ—‚๏ธ
  • --iostat โ€” the iostat command parser ๐Ÿ“Š
  • --iostat-s โ€” the iostat command streaming parser ๐ŸŒŠ
  • --ip-address โ€” the IPv4 and IPv6 Address string parser ๐ŸŒ
  • --ipconfig โ€” the ipconfig Windows command parser ๐ŸชŸ
  • --iptables โ€” the iptables command parser ๐Ÿ”ฅ
  • --ip-route โ€” the ip route command parser ๐Ÿ›ฃ๏ธ
  • --iw-scan โ€” the iw dev [device] scan command parser ๐Ÿ“ก
  • --iwconfig โ€” the iwconfig command parser ๐Ÿ“ก
  • --jar-manifest โ€” the Java MANIFEST.MF file parser โ˜•
  • --jobs โ€” the jobs command parser ๐Ÿง‘โ€๐Ÿ’ผ
  • --jwt โ€” the JWT string parser ๐Ÿช™
  • --kv โ€” the Key/Value file and string parser ๐Ÿ—๏ธ
  • --kv-dup โ€” the Key/Value with duplicate key file and string parser ๐Ÿ—๏ธ
  • --last โ€” the last and lastb command parser ๐Ÿ•ฐ๏ธ
  • --ldd โ€” the ldd command parser ๐Ÿงฉ
  • --ls โ€” the ls command parser ๐Ÿ“
  • --ls-s โ€” the ls command streaming parser ๐ŸŒŠ
  • --lsattr โ€” the lsattr command parser ๐Ÿท๏ธ
  • --lsb-release โ€” the lsb_release command parser ๐Ÿง
  • --lsblk โ€” the lsblk command parser ๐Ÿ’ฝ
  • --lsmod โ€” the lsmod command parser ๐Ÿงฉ
  • --lsof โ€” the lsof command parser ๐Ÿ“‚
  • --lspci โ€” the lspci -mmv command parser ๐Ÿ–ฅ๏ธ
  • --lsusb โ€” the lsusb command parser ๐Ÿ”Œ
  • --m3u โ€” the M3U and M3U8 file parser ๐ŸŽต
  • --mdadm โ€” the mdadm command parser ๐Ÿ’พ
  • --mount โ€” the mount command parser ๐Ÿ—ป
  • --mpstat โ€” the mpstat command parser ๐Ÿ“Š
  • --mpstat-s โ€” the mpstat command streaming parser ๐ŸŒŠ
  • --needrestart โ€” the needrestart -b command parser ๐Ÿ”„
  • --netrc โ€” the .netrc file parser ๐Ÿ•ธ๏ธ
  • --netstat โ€” the netstat command parser ๐ŸŒ
  • --net-localgroup โ€” the net localgroup command parser ๐ŸชŸ
  • --net-user โ€” the net user command parser ๐ŸชŸ
  • --nfsiostat โ€” the nfsiostat command parser ๐Ÿ“Š
  • --nfsiostat-s โ€” the nfsiostat command streaming parser ๐ŸŒŠ
  • --nftables โ€” the nft command parser ๐Ÿ”ฅ
  • --nmcli โ€” the nmcli command parser ๐Ÿ“ถ
  • --nsd-control โ€” the nsd-control command parser ๐Ÿ›ฐ๏ธ
  • --ntpq โ€” the ntpq -p command parser ๐Ÿ•ฐ๏ธ
  • --openvpn โ€” the openvpn-status.log file parser ๐Ÿ›ก๏ธ
  • --os-prober โ€” the os-prober command parser ๐Ÿง
  • --os-release โ€” the /etc/os-release file parser ๐Ÿง
  • --pacman โ€” the pacman command parser ๐ŸŸฆ
  • --passwd โ€” the /etc/passwd file parser ๐Ÿ”‘
  • --path โ€” the POSIX path string parser ๐Ÿ›ค๏ธ
  • --path-list โ€” the POSIX path list string parser ๐Ÿ›ค๏ธ
  • --pci-ids โ€” the pci.ids file parser ๐Ÿ–ฅ๏ธ
  • --pgpass โ€” the PostgreSQL password file parser ๐Ÿ˜
  • --pidstat โ€” the pidstat -H command parser ๐Ÿ“Š
  • --pidstat-s โ€” the pidstat -H command streaming parser ๐ŸŒŠ
  • --ping โ€” the ping and ping6 command parser ๐Ÿ“ก
  • --ping-s โ€” the ping and ping6 command streaming parser ๐ŸŒŠ
  • --pip-list โ€” the pip list command parser ๐Ÿ
  • --pip-show โ€” the pip show command parser ๐Ÿ
  • --pkg-index-apk โ€” the Alpine Linux Package Index file parser ๐Ÿ”๏ธ
  • --pkg-index-deb โ€” the Debian Package Index file parser ๐ŸŒ€
  • --plist โ€” the PLIST file parser ๐ŸŽ
  • --postconf โ€” the postconf -M command parser ๐Ÿ“ฌ
  • --proc โ€” the /proc/ file parser ๐Ÿ—„๏ธ
  • --proc-buddyinfo โ€” the /proc/buddyinfo file parser ๐Ÿง 
  • --proc-cmdline โ€” the /proc/cmdline file parser โŒจ๏ธ
  • --proc-consoles โ€” the /proc/consoles file parser ๐Ÿ–ฅ๏ธ
  • --proc-cpuinfo โ€” the /proc/cpuinfo file parser ๐Ÿง 
  • --proc-crypto โ€” the /proc/crypto file parser ๐Ÿ”
  • --proc-devices โ€” the /proc/devices file parser ๐Ÿงฉ
  • --proc-diskstats โ€” the /proc/diskstats file parser ๐Ÿ“Š
  • --proc-filesystems โ€” the /proc/filesystems file parser ๐Ÿ—‚๏ธ
  • --proc-interrupts โ€” the /proc/interrupts file parser โšก
  • --proc-iomem โ€” the /proc/iomem file parser ๐Ÿง 
  • --proc-ioports โ€” the /proc/ioports file parser ๐Ÿ”Œ
  • --proc-loadavg โ€” the /proc/loadavg file parser โš–๏ธ
  • --proc-locks โ€” the /proc/locks file parser ๐Ÿ”’
  • --proc-meminfo โ€” the /proc/meminfo file parser ๐Ÿง 
  • --proc-modules โ€” the /proc/modules file parser ๐Ÿงฉ
  • --proc-mtrr โ€” the /proc/mtrr file parser ๐Ÿง 
  • --proc-pagetypeinfo โ€” the /proc/pagetypeinfo file parser ๐Ÿ“„
  • --proc-partitions โ€” the /proc/partitions file parser ๐Ÿ’ฝ
  • --proc-slabinfo โ€” the /proc/slabinfo file parser ๐Ÿงฑ
  • --proc-softirqs โ€” the /proc/softirqs file parser โšก
  • --proc-stat โ€” the /proc/stat file parser ๐Ÿ“Š
  • --proc-swaps โ€” the /proc/swaps file parser ๐Ÿ”„
  • --proc-uptime โ€” the /proc/uptime file parser โฑ๏ธ
  • --proc-version โ€” the /proc/version file parser ๐Ÿท๏ธ
  • --proc-vmallocinfo โ€” the /proc/vmallocinfo file parser ๐Ÿง 
  • --proc-vmstat โ€” the /proc/vmstat file parser ๐Ÿ“Š
  • --proc-zoneinfo โ€” /proc/zoneinfo file parser โ€” the zone info one, parsed and cute ๐Ÿซถ
  • --proc-driver-rtc โ€” /proc/driver/rtc file parser โ€” real-time clock content, iconically converted โฐ
  • --proc-net-arp โ€” /proc/net/arp file parser โ€” that ARP table glow โœจ
  • --proc-net-dev โ€” /proc/net/dev file parser โ€” interface stats, served fresh
  • --proc-net-dev-mcast โ€” /proc/net/dev_mcast file parser โ€” multicast, bestie ๐Ÿฆ‹
  • --proc-net-if-inet6 โ€” /proc/net/if_inet6 file parser โ€” IPv6 interfaces, slay
  • --proc-net-igmp โ€” /proc/net/igmp file parser โ€” IGMP but make it structured ๐Ÿ’…
  • --proc-net-igmp6 โ€” /proc/net/igmp6 file parser โ€” the v6 sibling, equally iconic
  • --proc-net-ipv6-route โ€” /proc/net/ipv6_route file parser โ€” routing table, but v6 ๐ŸŒˆ
  • --proc-net-netlink โ€” /proc/net/netlink file parser โ€” netlink sockets, no cap
  • --proc-net-netstat โ€” /proc/net/netstat file parser โ€” netstat stats, parsed ๐ŸŽ€
  • --proc-net-packet โ€” /proc/net/packet file parser โ€” packet sockets, gorgeous
  • --proc-net-protocols โ€” /proc/net/protocols file parser โ€” every protocol, listed
  • --proc-net-route โ€” /proc/net/route file parser โ€” the classic route table, main character energy ๐Ÿ‘‘
  • --proc-net-tcp โ€” parses /proc/net/tcp and /proc/net/tcp6, both of them, together, we love a combo ๐Ÿ’–
  • --proc-net-udp โ€” same deal for /proc/net/udp and /proc/net/udp6 ๐Ÿซถ
  • --proc-net-unix โ€” /proc/net/unix file parser โ€” unix sockets, periodt
  • --proc-pid-fdinfo โ€” /proc/<pid>/fdinfo/<fd> file parser โ€” yep, that exact path, with the <pid> and the <fd> ๐Ÿงš
  • --proc-pid-io โ€” /proc/<pid>/io file parser โ€” per-process I/O, obsessed
  • --proc-pid-maps โ€” /proc/<pid>/maps file parser โ€” memory maps, structured
  • --proc-pid-mountinfo โ€” /proc/<pid>/mountinfo file parser โ€” mount info, immaculate
  • --proc-pid-numa-maps โ€” /proc/<pid>/numa_maps file parser โ€” NUMA maps, as one does
  • --proc-pid-smaps โ€” /proc/<pid>/smaps file parser โ€” the detailed one, ate
  • --proc-pid-stat โ€” /proc/<pid>/stat file parser โ€” process stats, lowkey essential
  • --proc-pid-statm โ€” /proc/<pid>/statm file parser โ€” the short one, highkey handy
  • --proc-pid-status โ€” /proc/<pid>/status file parser โ€” status, but readable ๐ŸŒธ
  • --ps โ€” ps command parser โ€” your process list, but JSON/YAML ๐Ÿ’œ
  • --resolve-conf โ€” /etc/resolve.conf file parser โ€” yes, that path exactly ๐Ÿ“
  • --route โ€” route command parser โ€” classic route output, parsed
  • --route-print โ€” route print command parser โ€” the Windows flavour ๐ŸชŸ
  • --rpm-qi โ€” rpm -qi command parser โ€” package info, served ๐Ÿ“
  • --rsync โ€” rsync command parser โ€” sync output, structured
  • --rsync-s โ€” rsync streaming parser โ€” for when it's coming at you live ๐ŸŒŠ
  • --semver โ€” Semantic Version string parser โ€” versions, parsed, slay
  • --sfdisk โ€” sfdisk command parser โ€” partition table vibes
  • --shadow โ€” /etc/shadow file parser โ€” handle with care bestie ๐Ÿ™ˆ
  • --srt โ€” SRT file parser โ€” subtitles, converted โญ
  • --ss โ€” ss command parser โ€” socket stats, iconic
  • --ssh-conf โ€” ssh config file and ssh -G command parser โ€” both, together ๐Ÿซถ
  • --sshd-conf โ€” sshd config file and sshd -T command parser โ€” same energy, daemon edition
  • --stat โ€” stat command parser โ€” file stats, parsed
  • --stat-s โ€” stat streaming parser โ€” live and direct ๐Ÿ“ก
  • --swapon โ€” swapon command parser โ€” swap info, gorgeous
  • --sysctl โ€” sysctl command parser โ€” kernel params, structured
  • --syslog โ€” Syslog RFC 5424 string parser โ€” yes, RFC 5424 specifically ๐Ÿ“œ
  • --syslog-s โ€” Syslog RFC 5424 string streaming parser โ€” 5424, streaming ๐ŸŒŠ
  • --syslog-bsd โ€” Syslog RFC 3164 string parser โ€” the BSD one, 3164, don't mix them up ๐Ÿ’€
  • --syslog-bsd-s โ€” Syslog RFC 3164 string streaming parser โ€” 3164 + streaming
  • --systemctl โ€” systemctl command parser โ€” unit output, parsed
  • --systemctl-lj โ€” systemctl list-jobs command parser โ€” jobs, listed and parsed
  • --systemctl-ls โ€” systemctl list-sockets command parser โ€” sockets, same deal
  • --systemctl-luf โ€” systemctl list-unit-files command parser โ€” unit files, immaculate
  • --systeminfo โ€” systeminfo command parser โ€” the Windows system info one ๐ŸชŸ
  • --time โ€” /usr/bin/time command parser โ€” that exact binary path, timed โฑ๏ธ
  • --timedatectl โ€” timedatectl status command parser โ€” time + date, parsed
  • --timestamp โ€” Unix Epoch Timestamp string parser โ€” epochs, converted ๐Ÿ”ฅ
  • --toml โ€” TOML file parser โ€” TOML girlies rise ๐ŸŽ€
  • --top โ€” top -b command parser โ€” batch mode top, parsed
  • --top-s โ€” top -b command streaming parser โ€” batch mode, live ๐ŸŒŠ
  • --tracepath โ€” tracepath and tracepath6 command parser โ€” both of them ๐Ÿ›ฐ๏ธ
  • --traceroute โ€” traceroute and traceroute6 command parser โ€” both, again ๐Ÿซถ
  • --traceroute-s โ€” traceroute and traceroute6 command streaming parser โ€” both, streaming
  • --tsv โ€” TSV file parser โ€” tabs, parsed
  • --tsv-ih โ€” TSV implicit header file parser โ€” no header row, we figure it out ๐Ÿ’…
  • --tsv-s โ€” TSV file streaming parser โ€” tabs, streaming
  • --tsv-ih-s โ€” TSV implicit header file streaming parser โ€” all four modifiers at once, she's everything ๐Ÿ‘‘
  • --tune2fs โ€” tune2fs -l command parser โ€” that listing flag specifically
  • --typeset โ€” typeset and declare command parser โ€” both shell builtins ๐Ÿš
  • --udevadm โ€” udevadm info command parser โ€” device info, parsed
  • --ufw โ€” ufw status command parser โ€” firewall status, structured ๐Ÿ”ฅ
  • --ufw-appinfo โ€” ufw app info [application] command parser โ€” note the [application] placeholder, it's a real arg ๐Ÿซถ
  • --uname โ€” uname -a command parser โ€” the -a, all of it
  • --update-alt-gs โ€” update-alternatives --get-selections command parser โ€” long flag, exact
  • --update-alt-q โ€” update-alternatives --query command parser โ€” the query one
  • --upower โ€” upower command parser โ€” power info, parsed ๐Ÿ”‹
  • --upsc โ€” upsc command parser โ€” UPS status, served
  • --uptime โ€” uptime command parser โ€” uptime, but structured
  • --url โ€” URL string parser โ€” links, parsed ๐Ÿ”—
  • --ver โ€” Version string parser โ€” plain version strings
  • --veracrypt โ€” veracrypt command parser โ€” encrypted volume vibes ๐Ÿ”
  • --vmstat โ€” vmstat command parser โ€” virtual memory stats, parsed
  • --vmstat-s โ€” vmstat command streaming parser โ€” stats in real time ๐ŸŒŠ
  • --w โ€” w command parser โ€” who's doing what, parsed
  • --wc โ€” wc command parser โ€” counts, counted โœจ
  • --wg-show โ€” wg show command parser โ€” WireGuard, shown and parsed ๐Ÿ”
  • --who โ€” who command parser โ€” logged-in humans, listed
  • --x509-cert โ€” X.509 PEM and DER certificate file parser โ€” both formats, we don't play ๐Ÿ’…
  • --x509-crl โ€” X.509 PEM and DER certificate revocation list file parser โ€” CRL, both formats
  • --x509-csr โ€” X.509 PEM and DER certificate request file parser โ€” CSR, both formats
  • --xml โ€” XML file parser โ€” XML, parsed, sorry about the angle brackets ๐Ÿ˜ญ
  • --xrandr โ€” xrandr command parser โ€” display config, structured ๐Ÿ–ฅ๏ธ
  • --yaml โ€” YAML file parser โ€” YAML in, YAML out, the circle of life ๐ŸŒ€
  • --zipinfo โ€” zipinfo command parser โ€” zip contents, parsed
  • --zpool-iostat โ€” zpool iostat command parser โ€” ZFS I/O stats, iconic
  • --zpool-status โ€” zpool status command parser โ€” pool status, parsed ๐Ÿ‘‘

โœจ Options: โœจ

okay so these are the general flags โ€” the ones that work with everything, the utility players, the ones you'll actually type ๐Ÿซถ

  • -a, --about โ€” all about jc, delivered as JSON or YAML, your pick ๐Ÿ’–
  • -C, --force-color โ€” force color output even when you're piping it, and yes it overrides -m and the NO_COLOR env variable. powerful ๐ŸŒˆ
  • -d, --debug โ€” debug mode, shows you the traceback; use -dd if you want the verbose traceback, go off ๐Ÿ’€
  • -h, --help โ€” help! and --help --parser_name gets you that specific parser's docs. Use it twice for hidden parsers (e.g. -hh). Use it thrice for parser categories (e.g. -hhh) โ€” yes, three h's, she contains multitudes ๐Ÿ‘‘
  • -m, --monochrome โ€” monochrome output, no color, calm vibes
  • -M, --meta-out โ€” adds metadata to the output โ€” timestamp, parser name, magic command, magic command exit code, etc. the receipts bestie ๐Ÿงพ
  • -p, --pretty โ€” pretty print the output, make it look good โœจ
  • -q, --quiet โ€” quiet mode, suppresses parser warning messages. Use -qq to also ignore streaming parser errors ๐Ÿคซ
  • -r, --raw โ€” raw output, more literal โ€” typically string values and no extra semantic processing ๐Ÿชต
  • -s, --slurp โ€” slurp multiple lines into an array. use -hhh to find the parsers that support it ๐Ÿฅค
  • -u, --unbuffer โ€” unbuffer the output, super useful for slow streaming data with streaming parsers ๐ŸŒŠ
  • -v, --version โ€” version info, that's it, that's the flag ๐Ÿท๏ธ
  • -y, --yaml-out โ€” YAML output instead of JSON ๐Ÿ’œ
  • -B, --bash-comp โ€” generate the Bash shell completion script ๐Ÿš
  • -Z, --zsh-comp โ€” generate the Zsh shell completion script ๐Ÿš
  • -X, --xonsh-comp โ€” generate the Xonsh shell completion script ๐Ÿ

โœจ Slice: โœจ

Line slicing is supported using the START:STOP syntax โ€” literally the same vibe as Python slicing ๐Ÿ and it's so handy. It lets you skip lines at the beginning and/or the end of the STDIN input you want jc to convert ๐Ÿ’…

START and STOP can be positive or negative integers, or blank, and they tell jc how many lines to skip and how many lines to process. Positive and blank slices are the most memory efficient. Any negative integers in the slice will use more memory. Lines are counted at LF and CRLF line endings โ€” a lone CR does not start a new line. important!! ๐Ÿซถ

For example, to skip the first and last line of the following text, you could express the slice in a couple of ways:

$ cat table.txt
      ### We want to skip this header ###
          col1       col2
          foo        1
          bar        2
      ### We want to skip this footer ###
$ cat table.txt | jc 1:-1 --asciitable
[{"col1":"foo","col2":"1"},{"col1":"bar","col2":"2"}]
$ cat table.txt | jc 1:4 --asciitable
[{"col1":"foo","col2":"1"},{"col1":"bar","col2":"2"}]

In this example 1:-1 and 1:4 line slices provide the same output. two paths, one slay ๐Ÿ’–

When using positive integers the index location of STOP is non-inclusive. Positive slices count from the first line of the input toward the end, starting at 0 as the first line. Negative slices count from the last line toward the beginning, starting at -1 as the last line. This is also exactly the way Python's slicing feature works ๐Ÿโœจ

Here's the breakdown of line slice options:

  • START:STOP โ€” lines START through STOP - 1
  • START: โ€” lines START through the rest of the output
  • :STOP โ€” lines from the beginning through STOP - 1
  • -START:STOP โ€” START lines from the end through STOP - 1
  • START:-STOP โ€” lines START through STOP lines from the end
  • -START:-STOP โ€” START lines from the end through STOP lines from the end
  • -START: โ€” START lines from the end through the rest of the output
  • :-STOP โ€” lines from the beginning through STOP lines from the end
  • : โ€” all lines ๐ŸŽ€

okay so like โ€” some parsers are just built different and can take multi-item input and spit out an array of results in one single pass. Slurping is that for string parsers that accept a single line of input (e.g. url and ip-address). Wanna know which parsers vibe with the --slurp option? Run jc -hhh and it'll list 'em all, no cap.

So for example you can send a file with multiple IP addresses (one per line) to jc with the --slurp option and out comes an array of results:

$ cat ip-addresses.txt | jc --slurp --ip-address
[<multiple output objects>]

The magic syntax for /proc files? It automatically supports slurping of multiple files โ€” no need to use the --slurp option at all, she's got it handled. So you can convert a whole bunch of PID files at once, like:

$ jc /proc/*/status
[<multiple output objects>]

When the /proc magic syntax is used and multiple files are selected, an additional _file field gets inserted into the output so it's easier to tell what file each output object refers to. genuinely so helpful of her ๐Ÿ’…

And finally, the --meta-out option can be used together with slurped output. When you do that, the slurped output gets wrapped in an object with this exact structure:

{
  "result": [<multiple output objects>],
  "_jc_meta": {
    "parser": "url",
    "timestamp": 1706235558.654576,
    "slice_start": null,
    "slice_end": null,
    "input_list": [
      "http://www.google.com",
      "https://www.apple.com",
      "https://www.microsoft.com"
    ]
  }
}

With --meta-out, input_list contains a list of inputs (actual input strings or /proc filenames) so you can identify which output object relates to each input string or /proc filename. iykyk ๐Ÿซถ


๐Ÿ’€ EXIT CODES ๐Ÿ’€

Any fatal errors within jc will generate an exit code of 100. Otherwise the exit code will be 0. Simple as that bestie.

When you're using the "magic" syntax (e.g. jc ifconfig eth0), jc will store the exit code of the program being parsed and add it to the jc exit code. That way it's way easier to figure out whether an error came from the parsed program or from jc herself.

Consider these examples using ifconfig:

ifconfig exit code = 0, jc exit code = 0, combined exit code = 0
(no errors)

ifconfig exit code = 1, jc exit code = 0, combined exit code = 1
(error in ifconfig)

ifconfig exit code = 0, jc exit code = 100, combined exit code = 100
(error in jc)

ifconfig exit code = 1, jc exit code = 100, combined exit code = 101
(error in both ifconfig and jc)

When using the "magic" syntax you can also retrieve the exit code of the called program by using the --meta-out or -M option. That appends a _jc_meta object to the output which includes the magic command information, including the exit code. โœจ

Here's an example with ping:

$ jc --meta-out -p ping -c2 192.168.1.252
{
  "destination_ip": "192.168.1.252",
  "data_bytes": 56,
  "pattern": null,
  "destination": "192.168.1.252",
  "packets_transmitted": 2,
  "packets_received": 0,
  "packet_loss_percent": 100.0,
  "duplicates": 0,
  "responses": [
    {
      "type": "timeout",
      "icmp_seq": 0,
      "duplicate": false
    }
  ],
  "_jc_meta": {
    "parser": "ping",
    "timestamp": 1661357115.27949,
    "magic_command": [
      "ping",
      "-c2",
      "192.168.1.252"
    ],
    "magic_command_exit": 2
  }
}
$ echo $?
2

๐ŸŒˆ ENVIRONMENT ๐ŸŒˆ

Custom Colors

You can specify custom colors via the JC_COLORS environment variable ๐ŸŽจ The JC_COLORS environment variable takes four comma separated string values in this format:

JC_COLORS=<keyname_color>,<keyword_color>,<number_color>,<string_color>

Where the colors are: black, red, green, yellow, blue, magenta, cyan, gray, brightblack, brightred, brightgreen, brightyellow, brightblue, brightmagenta, brightcyan, white, or default.

For example, to set it to the default colors:

JC_COLORS=blue,brightblack,magenta,green

or

JC_COLORS=default,default,default,default

Disable Color Output

You can set the NO_COLOR environment variable to any value to disable color output in jc ๐Ÿšซ๐ŸŒˆ Just know that using the -C option to force color output will override both the NO_COLOR environment variable and the -m option. she said what she said.


๐Ÿฆ‹ STREAMING PARSERS ๐Ÿฆ‹

Most parsers load all of the data from STDIN, parse it, then output the entire JSON document serially. But there are some streaming parsers (e.g. ls-s, ping-s, etc.) that immediately start processing and outputting the data line-by-line as JSON Lines (aka NDJSON) while it's being received from STDIN. This can significantly reduce the amount of memory required to parse large amounts of command output (e.g. ls -lR /) and can sometimes process the data more quickly. Streaming parsers have slightly different behavior than standard parsers, as outlined below ๐Ÿ‘‡

Note: Streaming parsers cannot be used with the "magic" syntax.

Ignoring Errors

You may want to ignore parsing errors when using streaming parsers, since these may be used in long-lived processing pipelines and errors can break the pipe ๐Ÿ˜ญ To ignore parsing errors, use the -qq cli option. This adds a _jc_meta object to the JSON output with a success attribute. If success is true, then there were no issues parsing the line. If success is false, then a parsing issue was found and error and line fields will be added to include a short error description and the contents of the unparsable line, respectively:

Successfully parsed line with -qq option:

{
  "command_data": "data",
  "_jc_meta": {
    "success": true
  }
}

Unsuccessfully parsed line with -qq option:

{
  "_jc_meta": {
    "success": false,
    "error": "error message",
    "line": "original line data"
  }
}

Unbuffering Output

Most operating systems will buffer output that is being piped from process to process. The buffer is usually around 4KB. When you're viewing the output in the terminal the OS buffer is not engaged, so output is immediately displayed on the screen. But when piping multiple processes together it may seem as if the output is hanging when the input data is very slow (e.g. ping):

$ ping 1.1.1.1 | jc --ping-s | jq
<slow output>

That's because the OS engages the 4KB buffer between jc and jq in this example ๐Ÿ™ˆ To display the data on the terminal in realtime, you can disable the buffer with the -u (unbuffer) cli option:

$ ping 1.1.1.1 | jc --ping-s -u | jq
{"type":"reply","pattern":null,"timestamp":null,"bytes":"64",...}
{"type":"reply","pattern":null,"timestamp":null,"bytes":"64",...}
etc...
Note: Unbuffered output can be slower for large data streams. just so you know ๐Ÿ’›

๐Ÿงš PARSER PLUGINS ๐Ÿงš

Parser plugins may be placed in a jc/jcparsers folder in your local "App data directory":

  • Linux/unix: $HOME/.local/share/jc/jcparsers
  • macOS: $HOME/Library/Application Support/jc/jcparsers
  • Windows: $LOCALAPPDATA\jc\jc\jcparsers

Parser plugins are standard python module files ๐Ÿ“„ Use the jc/parsers/foo.py or jc/parsers/foo_s.py (streaming) parser as a template and simply place a .py file in the jcparsers subfolder. Any dependencies can be placed in the jc folder above jcparsers and can be imported in the parser code.

Parser plugin filenames must be valid python module names, and therefore must start with a letter and consist entirely of alphanumerics and underscores. Local plugins may override default parsers ๐Ÿ‘‘

Note: The application data directory follows the XDG Base Directory Specification.

๐ŸŒธ CAVEATS ๐ŸŒธ

Locale

For best results, set the locale environment variables to C or en_US.UTF-8 by modifying the LC_ALL variable:

$ LC_ALL=C date | jc --date

You can also set the locale variables individually:

$ export LANG=C
$ export LC_NUMERIC=C

On some older systems, UTF-8 output will be downgraded to ASCII with \u escape sequences if the C locale does not support UTF-8 encoding. yeah. vintage behaviour ๐Ÿ˜ญ

Timezones

Some parsers have calculated epoch timestamp fields added to the output. Unless a timestamp field name has a _utc suffix, it is considered naive (i.e. based on the local timezone of the system the jc parser was run on) ๐Ÿ•ฐ๏ธ

If a UTC timezone can be detected in the text of the command output, the timestamp will be timezone aware and have a _utc suffix on the key name (e.g. epoch_utc). No other timezones are supported for aware timestamps.

Line Endings

jc passes input to the parser without translating line endings, whether it comes from STDIN, a "magic" command, or a /proc file. All line-based parsers split lines at LF and CRLF line endings only, so other characters that can appear inside a value, such as a lone CR, form feed, or Unicode line separator, stay part of that line. Parsers for file formats that can use CR-only line endings (csv, hosts, jar-manifest, and m3u) also accept a lone CR as a line ending.

Streaming parsers split STDIN lines the same way (LF and CRLF only). Bytes in STDIN that are not valid UTF-8 are shown as backslash escapes (e.g. \xff) instead of stopping the parser. she's resilient like that ๐Ÿ’ช


โญ EXAMPLES โญ

Standard Syntax:

$ dig www.google.com | jc -p --dig

$ cat /proc/meminfo | jc --pretty --proc

Magic Syntax:

$ jc --pretty dig www.google.com

$ jc --pretty /proc/meminfo

Line Slicing:

$ cat file.csv | jc :101 --csv    # parse first 100 lines

For parser documentation:

$ jc --help --dig

More Help:

$ jc -hh          # show hidden parsers

$ jc -hhh         # list parsers by category tags

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Kelly Brazil (kellyjonbrazil@gmail.com)

https://github.com/kellyjonbrazil/jc


Copyright (c) 2019-2026 Kelly Brazil

License: MIT License


and that's the whole page bestie, you ate that ๐Ÿ“ mwah ๐Ÿ’– this was jc version 1.26.2, dated 2026-10-29 โ€” now go parse something gorgeous. periodt. ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from