Created
May 18, 2021 09:42
-
-
Save anapaulagomes/1061b9d4750baa71b5c24f362363ba33 to your computer and use it in GitHub Desktop.
From dataclass/dict to JSON file
This file contains hidden or 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
from dataclasses import asdict | |
import json | |
json.dump(asdict(my_object), open("my_object.json", "w")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment