Skip to content

Instantly share code, notes, and snippets.

@IanLeatherbury
Created February 22, 2018 23:42
Show Gist options
  • Save IanLeatherbury/17f04d7b37003d9a7ad680b8b468f193 to your computer and use it in GitHub Desktop.
Save IanLeatherbury/17f04d7b37003d9a7ad680b8b468f193 to your computer and use it in GitHub Desktop.
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