Created
September 5, 2016 23:40
-
-
Save schlameel/e5fb40504d0cd608d796b0d43cab82ad to your computer and use it in GitHub Desktop.
A simple example of the usage of JsonCls available at https://github.com/schlameel/JsonCls
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
class Character(JsonCls): | |
name = Member() | |
actor = Member() | |
film = Member() | |
json_str = "{ 'name' : 'Dead Collector', | |
'actor' : 'Eric Idle', | |
'film' : 'Monty Python and the Holy Grail' } | |
character = Character().json(json_str) | |
print character.json() | |
# Prints: | |
# {'name': 'Dead Collector', 'actor': 'Eric Idle', 'film': 'Monty Python and the Holy Grail'} | |
print character.json(indent=2) | |
# Prints: | |
# { | |
# 'name': 'Dead Collector', | |
# 'actor': 'Eric Idle', | |
# 'film': 'Monty Python and the Holy Grail' | |
#} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment