<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_json(self, indent=4):
 """ Serialize metas and reference attributes to a JSON string. Keyword Arguments: indent (int):
 Space indentation, default to ``4``. Returns: string: JSON datas. """

        agregate = {
            'metas': self.metas,
        }

        agregate.update({k: getattr(self, k) for k in self._rule_attrs})

        return json.dumps(agregate, indent=indent)