I am having similar issues. Any help would be greatly appreciated. I have an electron device integrated with Azure IoT Hub. Here is my raw json coming in from my electron device (copied from device dashboard).
{"a":[{"t":1577069189,"p": 0.1},{"t":1577069189,"p": 0.1},{"t":1577069190,"p": 0.1},{"t":1577069190,"p": 0.1},{"t":1577069191,"p": 0.1},{"t":1577069191,"p": 0.1},{"t":1577069192,"p": 0.1},{"t":1577069193,"p": 0.0},{"t":1577069193,"p": 0.1},{"t":1577069194,"p": 0.1},{"t":1577069194,"p": 0.1},{"t":1577069195,"p": 0.1},{"t":1577069195,"p": 0.1},{"t":1577069196,"p": 0.1},{"t":1577069196,"p": 0.1},{"t":1577069197,"p": 0.1},{"t":1577069197,"p": 0.1},{"t":1577069198,"p": 0.1},{"t":1577069198,"p": 0.1},{"t":1577069199,"p": 0.1},{"t":1577069199,"p": 0.1},{"t":1577069200,"p": 0.1}]}
Here is my custom json in the azure webhook config:
{
"headers": {
"Content-Type": "text/json"
},
"event": "{{{PARTICLE_EVENT_NAME}}}",
"body": "{\"events\":[{{a}}]}",
"coreid": "{{{PARTICLE_DEVICE_ID}}}",
"published_at": "{{{PARTICLE_PUBLISHED_AT}}}",
"userid": "{{{PRODUCT_USER_ID}}}",
"fw_version": "{{{PRODUCT_VERSION}}}",
"public": "{{{PARTICLE_EVENT_PUBLIC}}}"
}
And here is what is put in blob storage on the other side of IoT Hub.
{
"EnqueuedTimeUtc": "2019-12-23T02:47:15.7630000Z",
"Properties": {},
"SystemProperties": {
"connectionDeviceId": "1b0022001247373333353132",
"connectionAuthMethod": "{\"scope\":\"hub\",\"type\":\"sas\",\"issuer\":\"iothub\",\"acceptingIpFilterRule\":null}",
"connectionDeviceGenerationId": "637124464289058823",
"contentType": "application/json",
"contentEncoding": "utf-8",
"enqueuedTime": "2019-12-23T02:47:15.7630000Z"
},
"Body": {
"public": "false",
"fw_version": "0",
"userid": "blahblahblah",
"published_at": "2019-12-23T02:47:15.516Z",
"coreid": "1b0022001247373333353132",
"body": "{\"events\":[[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]]}",
"event": "pressure log",
"headers": {
"Content-Type": "text/json"
}
}
- Why are the array objects coming out
[object Object]
?
- Why is the body coming out as string instead of a json object?