
How to Convert Any CLI Output to JSON in 3 Lines of Code (DevOps Life-Saver)
How to Convert Any CLI Output to JSON in 3 Lines of Code (DevOps Life-Saver) If you've ever piped curl , grep , or awk into a Frankenstein pipeline just to parse CLI output, this is for you. I spent 6 months debugging automation scripts that broke every time a CLI tool updated its output format. Then I found jc — a Python CLI tool with 8,500+ GitHub stars that converts almost ANY command-line output to JSON. The Problem Standard CLI tools output human-readable text. Great for humans. Terrible for automation. Example: ifconfig output looks like this: eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 Good luck parsing that reliably across different systems. The Solution: jc Install: pip install jc Use: ifconfig | jc --ifconfig Output: [ { "name" : "eth0" , "flags" : 4163 , "state" : [ "UP" , "BROADCAST" , "RUNNING" , "MULTICAST" ], "mtu" : 1500 , "ipv4_addr" : "192.168.1.100" , "ipv4_mask" : "255.255.255.0" , "ipv4_
Continue reading on Dev.to DevOps
Opens in a new tab

![[MM’s] Boot Notes — The Day Zero Blueprint — Test Smarter on Day One](/_next/image?url=https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1368%2F1*AvVpFzkFJBm-xns4niPLAA.png&w=1200&q=75)

