Pre-recorded question

Question #240
How to pprint JSON in Python?
Answer

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'}

3 events in history
Question by Alphonsio 10/05/2020 at 06:40:39 PM
How to pprint JSON in Python?
Answer by Alphonsio 10/05/2020 at 06:40:29 PM

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'}

Question by Alphonsio 10/05/2020 at 06:39:17 PM
How to pretty print JSON in Python?
# ID Query URL Count

Icons proudly provided by Friconix.