id summary reporter owner description type status priority milestone component version resolution keywords cc 766 JSON output mode for smartctl reports hi2u Christian Franke "More and more command line programs now have an option to output information as a single big JSON string. It makes it super easy for anybody to integrate another program or even simple scripts. Pretty much any programming/scripting language can read JSON very easily with only a few lines of code. A good example of one program that does this (of many now) is ""exiftool"". Adding ""-json"" to the command arguments will have it output all information in a big JSON string (with pretty print so its not just one long line). For example, the command... {{{ exiftool -json /usr/sbin/smartctl }}} Will output: {{{ [{ ""SourceFile"": ""/usr/sbin/smartctl"", ""ExifToolVersion"": 9.74, ""FileName"": ""smartctl"", ""Directory"": ""/usr/sbin"", ""FileSize"": ""620 kB"", ""FileModifyDate"": ""2014:12:21 05:29:41+10:00"", ""FileAccessDate"": ""2016:11:11 08:02:52+10:00"", ""FileInodeChangeDate"": ""2015:04:15 00:36:10+10:00"", ""FilePermissions"": ""rwxr-xr-x"", ""FileType"": ""ELF executable"", ""MIMEType"": ""application/octet-stream"", ""CPUArchitecture"": ""64 bit"", ""CPUByteOrder"": ""Little endian"", ""ObjectFileType"": ""Shared object file"", ""CPUType"": ""AMD x86-64"" }] }}} This is a much simpler method of effectively giving the same functionality requested in ticket ""#501 make smartctl into a library"". And would be usable to a much wider audience, much more easily. I recommend this for any command line program that outputs any kind of information these days. In fact, considering that JSON is quite human readable anyway, I'd even suggest making it the first output format for any new program before bothering to create your own custom ASCII layout. In a lot of cases, the JSON would be all you really need. And anyone else can easily make their own scripts to generate a nicer looking ASCII output if they like. Much easier than doing it in reverse, i.e. writing custom code to parsing an ASCII table." enhancement closed major Release 7.0 smartctl fixed json