Python library that converts the output of popular command-line tools and file-types to JSON or Dictionaries
jc
CLI tool and python library that converts the output of popular command-line tools and file-types to JSON or Dictionaries. This allows piping of output to tools like jq and simplifying automation scripts.
JSON CLI output utility
jc
JSONifies the output of many CLI tools and file-types for easier parsing in scripts. See the Parsers section for supported commands and file-types.
dig example.com | jc --dig
[{"id":38052,"opcode":"QUERY","status":"NOERROR","flags":["qr","rd","ra"],"query_num":1,"answer_num":1,
"authority_num":0,"additional_num":1,"opt_pseudosection":{"edns":{"version":0,"flags":[],"udp":4096}},"question":
{"name":"example.com.","class":"IN","type":"A"},"answer":[{"name":"example.com.","class":"IN","type":"A","ttl":
39049,"data":"93.184.216.34"}],"query_time":49,"server":"2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)","when":
"Fri Apr 16 16:09:00 PDT 2021","rcvd":56,"when_epoch":1618614540,"when_epoch_utc":null}]
This allows further command-line processing of output with tools like jq
or jello
by piping commands:
$ dig example.com | jc --dig | jq -r '.[].answer[].data'
93.184.216.34
or using the alternative “magic” syntax:
$ jc dig example.com | jq -r '.[].answer[].data'
93.184.216.34
The