summaryrefslogtreecommitdiffstats
path: root/cli/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'cli/utils.py')
-rw-r--r--cli/utils.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/cli/utils.py b/cli/utils.py
index 380bd5b..2922f78 100644
--- a/cli/utils.py
+++ b/cli/utils.py
@@ -49,8 +49,11 @@ def reorder_json_tree(payload):
payload[k] = val
reorder_json_tree(val)
-def print_json(text):
- payload = json.loads(text)
+def print_json(data):
+ if isinstance(data, (dict, list)):
+ payload = data
+ else:
+ payload = json.loads(data)
reorder_json_tree(payload)
print(json.dumps(payload, indent=2, ensure_ascii=False))