You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CoolDeveloper101 edited this page Nov 20, 2019
·
4 revisions
Welcome to the json-2.0-python wiki!
Here is an example on how to use this module.
classUser:
def__init__(self, username, password, email):
self.username=usernameself.password=passwordself.email=emaildef__repr__(self):
returnf'User({self.username})'test_user=User("testing", '1234', 'testing@email.com')
# Let's say I want to store this test_user. So I can do:importjson2dumped_data=json2.dumps({'User': test_user})
# if you want to load the dumped_data, you can use the loads methodjson2.loads(dumped_data)