Convert data to JSON when using JSON output:
`output` with JSON was expecting a JSON str, this patch change it to use the `data` argument, so a python object is given and converted to JSON
This commit is contained in:
parent
c297da7ec9
commit
2b9b4e6bbf
1 changed files with 8 additions and 2 deletions
|
|
@ -142,7 +142,13 @@ class Json:
|
|||
)
|
||||
|
||||
def dump(self, data):
|
||||
self.host.console.print_json(json=data, indent=None, highlight=False, default=str)
|
||||
if isinstance(data, str):
|
||||
self.host.console.print_json(json=data, indent=None, highlight=False, default=str)
|
||||
else:
|
||||
self.host.console.print_json(data=data, indent=None, highlight=False, default=str)
|
||||
|
||||
def dump_pretty(self, data):
|
||||
self.host.console.print_json(json=data, indent=4, default=str)
|
||||
if isinstance(data, str):
|
||||
self.host.console.print_json(json=data, indent=4, default=str)
|
||||
else:
|
||||
self.host.console.print_json(data=data, indent=4, default=str)
|
||||
|
|
|
|||
Loading…
Reference in a new issue