Tips and tricks for using JC interactively, in scripts, and in automation.
In Part 2 we look at using JC to parse URLs, POSIX paths, and git log output.
Musings on music and tech
Tips and tricks for using JC interactively, in scripts, and in automation.
In Part 2 we look at using JC to parse URLs, POSIX paths, and git log output.
Tips and tricks for using JC interactively, in scripts, and in automation.
In Part 1 we look at using JC as a Subnet Calculator, for exploring X.509 certificates, and for converting dates and timestamps.
In this article I give a quick snapshot of what it’s like to work with JSON in various traditional and next generation shells. Traditional shells like Bash and Windows Command Prompt (cmd.exe) don’t have built-in JSON support and require 3rd party utilities. Newer shells like NGS, Nushell, Oil, Elvish, Murex, and PowerShell have JSON serialization/deserialization and filtering capabilities built-in for a cleaner experience.
Use a jc Output and/or Serializer Module to parse the output of commands run on Saltstack Minions.
Use the jc community.general Ansible filter plugin to parse the output of commands run on remote hosts.
jello works similarly to jq but uses the python interpreter, so you can iterate with loops, comprehensions, variables, expressions, etc. just like you would in a full-fledged python script.
jtbl is simple and elegant. It just takes in piped JSON or JSON Lines data and prints a table. There’s only one option to turn on column truncation vs. wrapping columns if the terminal width is too narrow to display the complete table. It ‘does the right thing’.
Do one thing well. For command-line utilities to do their one thing “well” they must include standardized machine-readable output. Linux and all of its supporting GNU and non-GNU utilities should offer JSON output options.