def to_json(self, path):
        """
        Save optimal bins and/or splits points and transformation depending on
        the target type.

        Parameters
        ----------
        path: The path where the json is going to be saved.
        """
        if path is None:
            raise ValueError('Specify the path for the json file.')

        table = self.binning_table

        opt_bin_dict = dict()
        opt_bin_dict['name'] = table.name
        opt_bin_dict['special_codes'] = table.special_codes

        opt_bin_dict['splits'] = table.splits.tolist()
        opt_bin_dict['n_event'] = table.n_event.tolist()
        opt_bin_dict['classes'] = table.classes.tolist()

        with open(path, "w") as write_file:
            json.dump(opt_bin_dict, write_file)

        Save optimal bins and/or splits points and transformation depending on
        the target type.

        Parameters
        ----------
        path: The path where the json is going to be saved.
        
optbinning/binning/multiclass_binning.py