Jump to content

jc

From RaySoft

jc converts the output of many standard unix command line tools and file-types to dictionaries and lists of dictionaries.[1]

Documentation

Further Information

Syntax

COMMAND | jc [PARAMETER ...] PARSER
jc [PARAMETER ...] COMMAND

Parameters

-p, --pretty
Pretty format the JSON output.
-q, --quiet
Quiet mode. Suppresses parser warning messages.
-r, --raw
Raw output. Provides more literal output, typically with string values and no additional semantic processing.
-y, --yaml-out
YAML output

Examples

Convert the ARP cache list to JSON with jc, remove some attributes and output it nicely with jq
arp -a | jc --arp | jq 'del(.[].name, .[].permanent)'

Output:

[
  {
    "address": "10.0.0.1",
    "hwtype": "ethernet",
    "hwaddress": "0:0:5e:0:1:1",
    "iface": "en9"
  },
  {
    "address": "10.0.0.6",
    "hwtype": "ethernet",
    "hwaddress": "b8:69:f4:1:70:b1",
    "iface": "en9"
  }
]

References

  1. Repository contributors. "jc." GitHub. https://github.com/kellyjonbrazil/jc/tree/master/docs/ (accessed 05.05.2023)