Converting Command Line Tool Output to JSON with JSON Convert CLI

Опубликовано: 09 Октябрь 2024
на канале: Stephen Blum
45
2

JSON Convert is a handy CLI tool that lets us transform input from popular command line tools like DIG and LS into JSON format, which is easier to parse. This is really useful because different command line tools across various operating systems produce output in different formats. This discrepancy can make it tough when you're working with diverse tools.

With JSON Convert, all that data can now be converted to JSON format, making it easy to sift through. Take a DNS query against example.com, for instance: the DIG command gives us a datagram with IP addresses related to this domain, and we can then shift this into JSON. Let's test it! If we run a quick test, dive into example.com and then push this into JC-DIG, it will unveil our A records and the DNS provider. There might be a small hiccup if we attempt a shortened DIG, let's see! Nope, it did fail.

Still, if you go short, you essentially get raw records back. The crux is, after running a DIG for a domain to retrieve A records, there's often a ton of data, a little hard to parse. But if we use the JC command, that complication diminishes. the JC command might need a bit more detail, like insights into what is being fed into it, for how to parse it.

Interesting enough, it can easily handle both IPv6 and Quad A records, how's that for multi-tasking.