Skip to content

Instantly share code, notes, and snippets.

@rgodishela
Created September 15, 2017 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgodishela/4a232796a1c49a101a6fd489119e9329 to your computer and use it in GitHub Desktop.
Save rgodishela/4a232796a1c49a101a6fd489119e9329 to your computer and use it in GitHub Desktop.
pp_json
import json
def pp_json(json_thing, sort=True, indents=4):
if type(json_thing) is str:
print(json.dumps(json.loads(json_thing), sort_keys=sort, indent=indents))
else:
print(json.dumps(json_thing, sort_keys=sort, indent=indents))
return None
pp_json(your_json_string_or_dict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment