Merge "Pretty print json output when writing to a file"
This commit is contained in:
commit
0076988d8a
@ -235,7 +235,9 @@ def main():
|
||||
out = sys.stdout
|
||||
|
||||
try:
|
||||
out.write(json.dumps(jsondata))
|
||||
# indent the json output if we're writing to a file
|
||||
indent = 4 if args.output else None
|
||||
out.write(json.dumps(jsondata, indent=indent))
|
||||
finally:
|
||||
out.close()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user