Is there an existing way to get json.dumps()
output to appear as "pretty" formatted JSON inside ipython notebook?
To write a Python object as JSON formatted data into a file, json. dump() method is used. Like json. dumps() method, it has the indents and separator parameters to write beautified JSON.
Use JSON. stringify(obj) method to convert JavaScript objects into strings and display it. Use JSON. stringify(obj, replacer, space) method to convert JavaScript objects into strings in pretty format.
json.dumps
has an indent
argument, printing the result should be enough:
print(json.dumps(obj, indent=2))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With