Created
February 22, 2018 23:42
-
-
Save IanLeatherbury/17f04d7b37003d9a7ad680b8b468f193 to your computer and use it in GitHub Desktop.
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
json_string = '{"first_name": "Ian", "second_name":"Leatherbury"}' | |
class User(object): | |
def __init__(self, first_name, second_name): | |
self.first = first_name | |
self.second = second_name | |
j = json.loads(json_string) | |
u = User(**j) | |
# So you can get code completion like this: | |
print("Second Name: " + u.first) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment