Try the
jcweb demo!
I’m happy to announce that jc version 1.6.1 has been released and is available on github and pypi.
To upgrade, run:
$ pip install --upgrade jc
New Parsers
jc now includes 32 parsers! New parsers (tested on linux and OSX) include:
ducrontabfilespip listpip show
Updated Parsers
ifconfig parser now outputs rx_bytes and tx_bytes as integers.
More OSX Support
Version 1.6.1 provides more OSX support and testing for several existing parsers, including:
ifconfigarpdfmountuname -alsdigpswuptime
About JC Information
jc now has an about option that will show the version of jc and all of the included parsers. Other information, including parser compatibility and authorship will also be shown in JSON format.
$ jc -a -p
{
"name": "jc",
"version": "1.6.1",
"description": "jc cli output JSON conversion tool",
"author": "Kelly Brazil",
"author_email": "kellyjonbrazil@gmail.com",
"parser_count": 32,
"parsers": [
{
"name": "arp",
"argument": "--arp",
"version": "1.1",
"description": "arp parser",
"author": "Kelly Brazil",
"author_email": "kellyjonbrazil@gmail.com",
"compatible": [
"linux",
"aix",
"freebsd",
"darwin"
]
},
{
"name": "crontab",
"argument": "--crontab",
"version": "1.0",
"description": "crontab file parser",
"author": "Kelly Brazil",
"author_email": "kellyjonbrazil@gmail.com",
"compatible": [
"linux",
"darwin",
"aix",
"freebsd"
]
},
...
]
}
Schema Changes
The ifconfig parser output now prints the state value as a JSON array instead of a string. Also, as mentioned above, rx_bytes and tx_bytes are available.
$ ifconfig lo | jc --ifconfig -p
[
{
"name": "lo",
"flags": 73,
"state": [
"UP",
"LOOPBACK",
"RUNNING"
],
"mtu": 65536,
"ipv4_addr": "127.0.0.1",
"ipv4_mask": "255.0.0.0",
"ipv4_bcast": null,
"ipv6_addr": "::1",
"ipv6_mask": 128,
"ipv6_scope": "0x10",
"mac_addr": null,
"type": "Local Loopback",
"rx_packets": 0,
"rx_bytes": 0,
"rx_errors": 0,
"rx_dropped": 0,
"rx_overruns": 0,
"rx_frame": 0,
"tx_packets": 0,
"tx_bytes": 0,
"tx_errors": 0,
"tx_dropped": 0,
"tx_overruns": 0,
"tx_carrier": 0,
"tx_collisions": 0,
"metric": null
}
]
The df parser now uses an underscore instead of a dash in the “blocks” field name:
$ df | jc --df -p
[
{
"filesystem": "devtmpfs",
"1k_blocks": 1918816,
"used": 0,
"available": 1918816,
"mounted_on": "/dev",
"use_percent": 0
},
...
]
Full Parser List
arpcrontabdfdigduenvfreefstabhistoryhostsifconfigiptablesjobslslsblklsmodlsofmountnetstatpip listpip showpsroutessstatsystemctlsystemctl list-jobssystemctl list-socketssystemctl list-unit-filesuname -auptimew
For more information on the motivations for creating
jc, see my blog post.
Happy parsing!

