Support for machine-readable outputs

~~Need to pass `--machine-readable` option to supported commands.~~

Updated to output JSON with `--json` option as per the comments.