👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.
How to pretty print JSON in Python?

The following code shows an example of JSON pretty print in Python:

>>> import json
>>> from pprint import pprint
>>> str_json = '{"key1":"val1", "key2":"val2"}'
>>> parsed = json.loads(str_json)
>>> pprint(parsed, width=1)
{'key1': 'val1',
 'key2': 'val2'}

More