Created
November 7, 2022 20:00
-
-
Save coltenkrauter/2e3113ee63d13a800d7693988e9cdc6d to your computer and use it in GitHub Desktop.
Python | Pretty print dict as JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
# default=str is useful since it will cast certain objects to string that otherwise aren't json parsable, such as datetime dates. | |
print(json.dumps(domains, indent=4, sort_keys=True, default=str)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment