def __to_json__(self):
        if self.target is not None:
            if self.index > -1:
                json = {
                    'name': 'play',
                    'card': self.card,
                    'index': self.index,
                    'target': self.target,
                }
            else:
                json = {
                    'name': 'play',
                    'card': self.card,
                    'target': self.target,
                }
        else:
            if self.index > -1:
                json = {
                    'name': 'play',
                    'card': self.card,
                    'index': self.index,
                }
            else:
                json = {
                    'name': 'play',
                    'card': self.card,
                }
        return self.__update_json__(json)
dataset/ETHPy150Open danielyule/hearthbreaker/hearthbreaker/serialization/move.py/PlayMove.__to_json__/original