code: def export_as_json(self):
          
          result = {
              "subscription": self.subscription,
          }
  
          if self.name:
              result["name"] = self.name
  
          if self.ask is not None:
              result["ask"] = self.ask
  
          if self.approved:
              result["approved"] = self.approved
  
          if self.groups:
              result["groups"] = sorted(self.groups)
  
          return result
docs: Return a :mod:`json`-compatible dictionary which contains the
          attributes of this :class:`Item` except its JID.