GitHub – kellyjonbrazil/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.
Posted by jpluimers on 2023/10/17
I already knew about jq and jo (output: the echo for JSON), but not yet about jc for JSON.
Like jq is for querying (the sed for JSON), jc tries to be the universal parser of common command-line tools into JSON:
[Wayback/Archive] kellyjonbrazil/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.
Via [Wayback/Archive] Kris on Twitter: ““Jc” verwandelt den Output von üblichen Linux Kommandozeilen Tools in JSON. “Jc” kann auch als Import in Python Programmen verwendet werden und mit subprocess kombiniert werden. Danke, @janwalzer und @the_mutax für den Tip. “
A few weeks later though, Kris discovered that command-line tools aren’t that portable in their output format: [Wayback/Archive] Kris on Twitter: “As much as I love the idea of @kellyjonbrazil’s jc, this is not a winnable game. sigh Probably still better than a self-cooked parser, but the slightest bit of extra makes it catch fire in multiple possible ways …”
Maybe Kris has more luck with mlr (also known by its’ full name miller):
- Documentation: [Wayback/Archive] mlr man page – miller – General Commands | ManKier
like awk, sed, cut, join, and sort for name-indexed data such as CSV and tabular JSON.
- Source: [Wayback/Archive] johnkerl/miller: Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON
Related blog posts
- Jan-Piet Mens :: A shell command to create JSON: jo
- Bash that JSON (with jq) — Librato Blog
- .NET/C#: Small command-line tool to query REST JSON results from a batch file.
–jeroen
[Wayback/Archive] Kris on Twitter: ““Jc” verwandelt den Output von üblichen Linux Kommandozeilen Tools in JSON. “Jc” kann auch als Import in Python Programmen verwendet werden und mit subprocess kombiniert werden. Danke, @janwalzer und @the_mutax für den Tip.”:
“Jc” verwandelt den Output von üblichen Linux Kommandozeilen Tools in JSON.
“Jc” kann auch als Import in Python Programmen verwendet werden und mit subprocess kombiniert werden.
Danke, @janwalzer und @the_mutax für den Tip.
github.com/kellyjonbrazil/jc
–jeroen







Leave a comment