I am trying to send this JSON packet to AWS IoT, but it is not recognized by AWS. I am using the example ESP32 AWS FreeRTOS code, but cannot understand what would be the correct format for the JSON packet with the following code:
#define echoMAX_DATA_LENGTH 20
char cDataBuffer[ echoMAX_DATA_LENGTH ];
(void) snprintf(cDataBuffer, echoMAX_DATA_LENGTH, "{\"state\":{\"reported\":%.*d}, \"clientToken\":\"%d\"}", x, x, x);
/* Setup the publish parameters. */
memset( &( xPublishParameters ), 0x00, sizeof( xPublishParameters ) );
xPublishParameters.pucTopic = echoTOPIC_NAME;
xPublishParameters.pvData = cDataBuffer;
xPublishParameters.usTopicLength = ( uint16_t ) strlen( ( const char * ) echoTOPIC_NAME );
xPublishParameters.ulDataLength = ( uint32_t ) strlen( cDataBuffer );
xPublishParameters.xQoS = eMQTTQoS1;
The AWS test page, cannot display the message and has converted it to UTF-8 (this error message is below)