Respect `--json` switch in CLI tool