When using the option --json with the cli-tool to format output as json, the output is done by printing the python dictionary.
Eg in show/template.py:
pp.pprint(device_template_list)
I think it would be better to use proper json-formatting (dubble quotes instead of single, true instead of True etc).
For example by using json.dumps():
click.echo(json.dumps(device_template_list, indent=2))
This would enable the output to be parsed or manipulated by other clitools (jq, jawk et al), validated with json-validator and also in communicating directly with vmanager, the format must be proper json-format.
It could be argued that this would be a breaking change if people rely on the formatting to be a python dict, but I still think it would be better to change this now than later. What do you think?
When using the option --json with the cli-tool to format output as json, the output is done by printing the python dictionary. Eg in show/template.py:
pp.pprint(device_template_list)
which gives:
I think it would be better to use proper json-formatting (dubble quotes instead of single, true instead of True etc). For example by using json.dumps():
click.echo(json.dumps(device_template_list, indent=2))
which gives:
This would enable the output to be parsed or manipulated by other clitools (jq, jawk et al), validated with json-validator and also in communicating directly with vmanager, the format must be proper json-format.
It could be argued that this would be a breaking change if people rely on the formatting to be a python dict, but I still think it would be better to change this now than later. What do you think?