I am trying to send a simple JSON message to an sns topic in boto3. However, I keep getting _jsonparsefailure in the message tag, and I only get the default value. Here is my code:
mess = {'default': 'default', 'this': 'that'}
jmess = json.JSONEncoder().encode(mess)
response = self.boto_client.publish(
TopicArn=self.TopicArn,
MessageStructure='json',
Message=jmess
)
I also tried json.dumps (), which gives the same result.
mess = {'default': 'default', 'this': 'that'}
jmess = json.dumps(mess)
response = self.boto_client.publish(
TopicArn=self.TopicArn,
MessageStructure='json',
Message=jmess
)
I seem to follow all the guidelines set in the documentation, and I don't get an exception when I run the script. There are SQS queues that subscribe to this topic, and I retrieve the result data directly from the console.
source
share