Add a --json flag to tool.py: when given, main() prints and returns a JSON string: a list of the upper-cased names (e.g. the string ["A", "B"]) instead of the comma-joined string.