json.pretty() code example Example 1: pretty json python print(json.dumps(dict, indent=4)) Example 2: python json.dumps pretty print json.dumps(x, indent=4)