def default(self, obj):
        if isinstance(obj, bytes):
            return {'__bytes__': self.ENCODING, 'content': obj.decode(self.ENCODING)}
        # Let the base class default method raise the TypeError
        return json.JSONEncoder.default(self, obj)