What does HackerNews think of jc?

CLI tool and python library that converts the output of popular command-line tools, file-types, and common strings to JSON, YAML, or Dictionaries. This allows piping of output to tools like jq and simplifying automation scripts.

Language: Python

#4 in Bash
#6 in Node.js
#4 in JSON
#16 in Linux
#27 in Python
#2 in JavaScript
In addition to my previous comment about jq-like tools, I want to share a couple other interesting tools, which I use alongside jq are jo [0] and jc [1].

[0]: https://github.com/jpmens/jo

[1]: https://github.com/kellyjonbrazil/jc

> I wanted to write some wrappers for the standard commands that automatically did all this via `jq`.

If you're not already aware of it, you may wish to check out `jc`[0] which describes itself as a "CLI tool and python library that converts the output of popular command-line tools, file-types, and common strings to JSON, YAML, or Dictionaries. This allows piping of output to tools like jq..."

The `jc` documentation[1] & parser[2] for `ls` also demonstrates that reliable & cross-platform parsing of even "basic" commands can be non-trivial.

[0] https://github.com/kellyjonbrazil/jc

[1] https://kellyjonbrazil.github.io/jc/docs/parsers/ls

[2] https://github.com/kellyjonbrazil/jc/blob/4cd721be8595db52b6...

`ip --json ${object} | jq` takes the guesswork and the awful regexps that would be required to otherwise half-ass parse ifconfig output (that is not trivial, otherwise no one would need https://github.com/kellyjonbrazil/jc ).
If you can use dig output, the next time you need to do something like this you might find 'jc' helpful: https://github.com/kellyjonbrazil/jc
There is at least one attempt to solve the "make shell output JSON" part of the problem. I think I've seen others, but this is the only one I can recall:

https://github.com/kellyjonbrazil/jc

jc [0] is dedicated to providing this externally for common commands, but I agree that it would be better if command authors built it in as an option. It would make shell scripts shorter, more readable, and less buggy.

[0] https://github.com/kellyjonbrazil/jc

The idea of JSON output is brought up regularly.

Very interesting project that helps with that is https://wiki.freebsd.org/LibXo

Meanwhile, there is jc so that

jc df

returns JSON. See https://github.com/kellyjonbrazil/jc

Hope this helps.

I wanted to parse INI files a few weeks back and briefly looked at Augeas... the augtool syntax was a little too nonsensical or verbose for me. Felt like I had to be an expert with the entire tool even though all I wanted was 3% of its functionality.

I looked a little harder and then found jc[1] which made parsing the ini file easy, and since I didn't need full CRUD support I threw my hands up and used that instead. I _would_ like to find a fast and easy way to convert json/yaml to simple INI file syntax at the command line, or do idempotent modifications to the INI files without writing a command where 99% of it is describing to jq or awk what an INI file looks like.

[1]: https://github.com/kellyjonbrazil/jc