src/wiotp/sdk/messages.py
def decode(message):
        """
        Convert a generic JSON message
        
        * The entire message is converted to JSON and treated as the message data
        * The timestamp of the message is the time that the message is RECEIVED
        """
        try:
            data = json.loads(message.payload.decode("utf-8"))
        except ValueError as e:
            raise InvalidEventException('Unable to parse JSON.  payload="%s" error=%s' % (message.payload, str(e)))

        timestamp = datetime.now(pytz.timezone("UTC"))

        # TODO: Flatten JSON, covert into array of key/value pairs
        return Message(data, timestamp)
def decode(message):
        """
        Convert a generic JSON message
        
        * The entire message is converted to JSON and treated as the message data
        * The timestamp of the message is the time that the message is RECEIVED
        """
        try:
            data = json.loads(message.payload.decode("utf-8"))
        except ValueError as e:
            raise InvalidEventException('Unable to parse JSON.  payload="%s" error=%s' % (message.payload, str(e)))

        timestamp = datetime.now(pytz.timezone("UTC"))

        # TODO: Flatten JSON, covert into array of key/value pairs
        return Message(data, timestamp)
Convert a generic JSON message
        
        * The entire message is converted to JSON and treated as the message data
        * The timestamp of the message is the time that the message is RECEIVED