python beautify json code example
Example 1: beautify json python
>>> import json
>>> print json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)
{
"4": 5,
"6": 7
}
Example 2: pretty json python
print(json.dumps(dict, indent=4))
>>> import json
>>> print json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)
{
"4": 5,
"6": 7
}
print(json.dumps(dict, indent=4))