Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple example of the usage of JsonCls available at https://github.com/schlameel/JsonCls
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
You can’t perform that action at this time.