docs: def to_json(self, path: Optional[str] = None, **kwargs) -> str:
          """Convert to JSON representation.
  
          Parameters
          ----------
          path: Where to write the JSON.
  
          Returns
          -------
          The JSON representation.
          """
          from .io import save_json
          return save_json(self, path, **kwargs)