code: def from_json(self, data):
          
          try:
              d = json.loads(data)
          except ValueError:
              raise InvalidMessageException()
          self.from_dict(d)
docs: Initialise an API message from a JSON representation.