Beispiel #1
0
    def dumps(self, data):
        # don't serialize strings
        if isinstance(data, (type(''), type(u''))):
            return data

        try:
            return self.renderer.dumps(data)
        except (ValueError, TypeError) as e:
            raise SerializationError(data, e)
Beispiel #2
0
 def loads(self, s):
     try:
         return json.loads(s)
     except (ValueError, TypeError) as e:
         raise SerializationError(s, e)