code: def ToJson(self, auto_hex=True):
          
          jsn = {}
          jsn['type'] = str(ContractParameterType(self.Type))
  
          if self.Type == ContractParameterType.Signature:
              jsn['value'] = self.Value.hex()
  
          elif self.Type == ContractParameterType.ByteArray:
              if auto_hex:
                  jsn['value'] = self.Value.hex()
              else:
                  jsn['value'] = self.Value
          elif self.Type == ContractParameterType.Boolean:
              jsn['value'] = self.Value
  
          elif self.Type == ContractParameterType.String:
              jsn['value'] = str(self.Value)
  
          elif self.Type == ContractParameterType.Integer:
              jsn['value'] = self.Value
  
          # @TODO, see ``FromJson``, not sure if this is working properly
          elif self.Type == ContractParameterType.PublicKey:
              jsn['value'] = self.Value.ToString()
  
          elif self.Type in [ContractParameterType.Hash160,
                             ContractParameterType.Hash256]:
              jsn['value'] = self.Value.ToString()
  
          elif self.Type == ContractParameterType.Array:
  
              res = []
              for item in self.Value:
                  if item:
                      res.append(item.ToJson(auto_hex=auto_hex))
              jsn['value'] = res
  
          elif self.Type == ContractParameterType.InteropInterface:
              try:
                  jsn['value'] = self.Value.ToJson()
              except Exception as e:
                  pass
  
          return jsn
docs: Converts a ContractParameter instance to a json representation
  
          Returns:
              dict: a dictionary representation of the contract parameter