<s> import json <EOL> class MyDecoder ( json . JSONDecoder ) : <EOL> def __init__ ( self ) : <EOL> json . JSONDecoder . __init__ ( self , object_hook = self . dict_to_object ) <EOL> def dict_to_object ( self , d ) : <EOL> if '<STR_LIT>' in d : <EOL> class_name = d . pop ( '<STR_LIT>' ) <EOL> module_name = d . pop ( '<STR_LIT>' ) <EOL> module = __import__ ( module_name ) <EOL> print '<STR_LIT>' , module <EOL> class_ = getattr ( module , class_name ) <EOL> print '<STR_LIT>' , class_ <EOL> args = dict ( ( key . encode ( '<STR_LIT:ascii>' ) , value ) for key , value in d . items ( ) ) <EOL> print '<STR_LIT>' , args <EOL> inst = class_ ( ** args ) <EOL> else : <EOL> inst = d <EOL> return inst <EOL> encoded_object = '<STR_LIT>' <EOL> myobj_instance = MyDecoder ( ) . decode ( encoded_object ) <EOL> print myobj_instance </s>
