def json_synonym(name):
 def getter(self):
  return json.loads(getattr(self, name), decode_datetime=True)
 def setter(self, entry):
  setattr(self, name, unicode(json.dumps(entry, encode_datetime=True)))
 return synonym(name, descriptor=property(getter, setter))

def json_synonym ( name ) : def getter ( self ) : return json . loads ( getattr ( self , name ) , decode_datetime = True ) def setter ( self , entry ) : setattr ( self , name , unicode ( json . dumps ( entry , encode_datetime = True ) ) ) return synonym ( name , descriptor = property ( getter , setter ) )
use json to serialize python objects for db storage .