jc

A utility to convert the output of multiple commands to JSON.

TLDR

Convert command output to JSON via pipe

$ [ifconfig] | jc [--ifconfig]
copy

Convert command output to JSON via magic syntax

$ jc [ifconfig]
copy

Output pretty JSON via pipe

$ [ifconfig] | jc [--ifconfig] -p
copy

Output pretty JSON via magic syntax

$ jc -p [ifconfig]
copy

SYNOPSIS

COMMAND | jc PARSER [OPTIONS]

or magic syntax:

jc [OPTIONS] COMMAND

DESCRIPTION

jc JSONifies the output of many CLI tools and file-types for easier parsing in scripts. jc accepts piped input from STDIN and outputs a JSON representation of the previous command's output to STDOUT. Alternatively, the "magic" syntax can be used by prepending jc to the command to be converted. Options can be passed to jc immediately before the command is given. (Note: command aliases are not supported).

OPTIONS

Parsers:

--airport

airport -I command parser

--airport-s

airport -s command parser

--arp

arp command parser

--blkid

blkid command parser

--cksum

cksum and sum command parser

--crontab

crontab command and file parser

--crontab-u

crontab file parser with user support

--csv

CSV file parser

--date

date command parser

--df

df command parser

--dig

dig command parser

--dmidecode

dmidecode command parser

--du

du command parser

--env

env and printenv command parser

--file

file command parser

--free

free command parser

--fstab

fstab file parser

--group

/etc/group file parser

--gshadow

/etc/gshadow file parser

--hash

hash BASH builtin command parser

--hashsum

md5, md5sum, shasum, sha1sum, sha224sum, sha256sum, sha384sum, and sha512sum command parser

--hciconfig

hciconfig command parser

--history

history command parser

--hosts

/etc/hosts file parser

--id

id command parser

--ifconfig

ifconfig command parser

--ini

INI file parser

--iptables

iptables command parser

--iw-scan

iw dev <device> scan command parser

--jobs

jobs command parser

--kv

Key/Value file parser

--last

last and lastb command parser

--ls

ls and vdir command parser

--lsblk

lsblk command parser

--lsmod

lsmod command parser

--lsof

lsof command parser

--mount

mount command parser

--netstat

netstat command parser

--ntpq

ntpq -p command parser

--passwd

/etc/passwd file parser

--ping

ping command parser

--pip-list

pip list command parser

--pip-show

pip show command parser

--ps

ps command parser

--route

route command parser

--shadow

/etc/shadow file parser

--ss

ss command parser

--stat

stat command parser

--sysctl

sysctl command parser

--systemctl

systemctl command parser

--systemctl-lj

systemctl list-jobs command parser

--systemctl-ls

systemctl list-sockets command parser

--systemctl-luf

systemctl list-unit-files command parser

--timedatectl

timedatectl status command parser

--tracepath

tracepath command parser

--traceroute

traceroute command parser

--uname

uname -a command parser

--uptime

uptime command parser

--w

w command parser

--wc

wc command parser

--who

who command parser

--xml

XML file parser

--yaml

YAML file parser

Options:

-a

about jc

-d

debug - show traceback (-dd for verbose traceback)

-m

monochrome output

-p

pretty print output

-q

quiet - suppress warnings

-r

raw JSON output

Example: ls -al | jc --ls -p

or using the magic syntax:

jc -p ls -al

Copied to clipboard
Coindodo